BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

TDirectoryListBox->Drive, capturing an exception using try

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> C++ Builder (Language C++)
View previous topic :: View next topic  
Author Message
Maurice Anderson
Guest





PostPosted: Tue Jun 28, 2005 7:53 am    Post subject: TDirectoryListBox->Drive, capturing an exception using try Reply with quote



Hello, I want to capture the error message in TDirectoryListBox when you
assign a non-existant drive to TDirectoryListBox->Drive. That way I can
iterate true all 26 letters of the alphabet to get the good drives. So I
dont want the user to see any error messages. I am sure the try/catch block
would work but i dont know how to use it please help.

Thanks


Back to top
Steve Aletto
Guest





PostPosted: Tue Jun 28, 2005 8:10 am    Post subject: Re: TDirectoryListBox->Drive, capturing an exception using t Reply with quote



Quote:
Hello, I want to capture the error message in
TDirectoryListBox when you assign a non-existant drive to
TDirectoryListBox->Drive. That way I can iterate true all 26
letters of the alphabet to get the good drives. So I dont
want the user to see any error messages. I am sure the
try/catch block would work but i dont know how to use it
please help.

I don't know exactly what exception is thrown, but this should
work:

try
{
DirectoryListBox1->Drive = 'K';
}
catch (...)
{
/* the drive doesn't exist or error */
}

API GetDriveType could be useful as well.

Steve.



Back to top
Steve Aletto
Guest





PostPosted: Tue Jun 28, 2005 8:19 am    Post subject: Re: TDirectoryListBox->Drive, capturing an exception using t Reply with quote



Quote:
I don't know exactly what exception is thrown

It's EInOutError.

Steve.



Back to top
Maurice Anderon
Guest





PostPosted: Fri Jul 01, 2005 2:42 am    Post subject: Re: TDirectoryListBox->Drive, capturing an exception using t Reply with quote

Quote:
I don't know exactly what exception is thrown

Yep, the error is EInOutError. Also using your code causes my personalized
message from catch(...) to come up as planned. Thanks.

However, the BCB exception window below still comes up before my
personalized message. Is there any way to have no exception window come up
at all? Basically, I want the user to see nothing except for wat I choose
them to see.

Thanks

"Steve Aletto" <steve_alettoANTI (AT) SPAMhotmail (DOT) com> wrote

Quote:
I don't know exactly what exception is thrown

It's EInOutError.

Steve.




Back to top
Steve Aletto
Guest





PostPosted: Fri Jul 01, 2005 8:35 am    Post subject: Re: TDirectoryListBox->Drive, capturing an exception using t Reply with quote

Quote:
However, the BCB exception window below still comes up before
my personalized message. Is there any way to have no
exception window come up at all? Basically, I want the user
to see nothing except for wat I choose them to see.

Running the code I posted, no exception comes up. So, I guess
either the problem is somewhere else in your code or you tried
only in debug mode and you have "Stop on Delphi Exceptions"
checked under the "Debugger options..." menu.

Steve.



Back to top
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> C++ Builder (Language C++) All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.