 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Maurice Anderson Guest
|
Posted: Tue Jun 28, 2005 7:53 am Post subject: TDirectoryListBox->Drive, capturing an exception using try |
|
|
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
|
Posted: Tue Jun 28, 2005 8:10 am Post subject: Re: TDirectoryListBox->Drive, capturing an exception using t |
|
|
| 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
|
Posted: Tue Jun 28, 2005 8:19 am Post subject: Re: TDirectoryListBox->Drive, capturing an exception using t |
|
|
| Quote: | I don't know exactly what exception is thrown
|
It's EInOutError.
Steve.
|
|
| Back to top |
|
 |
Maurice Anderon Guest
|
Posted: Fri Jul 01, 2005 2:42 am Post subject: Re: TDirectoryListBox->Drive, capturing an exception using t |
|
|
| 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
|
Posted: Fri Jul 01, 2005 8:35 am Post subject: Re: TDirectoryListBox->Drive, capturing an exception using t |
|
|
| 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 |
|
 |
|
|
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
|
|