Solved

Handling EInOutError

Posted on 1997-10-19
8
662 Views
Last Modified: 2008-02-07
Hi, I'm new in Delphi, so my question is simple:
How can I change standard 'I/O error 21' message to my own message?
I call SelectDirectory function, and when there is no floppy in a: drive and user selects this drive, such message occurs.
I tried code:
try
  SelectDirectory (...);
except
  on EInOutrror do <here I put my own message box>;
end;

but Delphi never enters that line after "except" word.
Could someone help ?

E.T.
0
Comment
Question by:et
  • 5
  • 2
8 Comments
 
LVL 5

Expert Comment

by:JimBob091197
Comment Utility
Hi

I think that you will not be able to change the error message, because Delphi shows the message and the exception never "floats" up to your exception handler.  Notice that if you select the A: drive, after you get the I/O error message, the SelectDirectory dialog has the Drive Box on A:, but the rest of the stuff on your last directory...  A buggy component???

What version of Delphi are you using?  If you are using ver 2 or 3, consider using the Windows 95 ShBrowseForFolder command.  This pops up a Windows shell dialog, which in my opinion works a lot better than Delphi's poor attempt with SelectDirectory.  I have a component which uses ShBrowseForFolder if you are interested...

JB
0
 
LVL 3

Expert Comment

by:mirek071497
Comment Utility
I don't sure if this is what you need, but you can first check if the drive is valid. If this is good for you i can submit simple example.
0
 
LVL 1

Author Comment

by:et
Comment Utility
To mirek:
  I thought about it, but I can't do that in SelectDirectory.
To JimBob:
  I use Delphi3 so I would be very appreciated if you can provide me an example with ShBrowseForFolder. Could I trap I/O error in there, because I must show a non-english comment for situation, when there is no floppy in drive A:, and this is most important for me.

thanx again
0
 
LVL 5

Expert Comment

by:JimBob091197
Comment Utility
When you use ShBrowseForFolder, the Windows shell handles everything for you.  I don't think you can trap I/O errors, or change the message if A: is not ready.

If you provide your e-mail address I will send the ShBrowseForFolder component to you anyway, and you can have a look.  The nice part about ShBrowseForFolder is that you can browse the network too.

The other alternative is to rewrite the SelectDirectory dialog found in FileCtrl.pas.  This should be an easy task, and you can trap the OnChange event of the drive combo yourself.

JB
0
Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

 
LVL 1

Author Comment

by:et
Comment Utility
JB,

my e-mail address is: et@homer.iinf.polsl.gliwice.pl, watch double 'i' in 'iinf'. Write also something as an answer to ExpExch, so I can grade you

E.T.
0
 
LVL 5

Expert Comment

by:JimBob091197
Comment Utility
I have sent the component, with a sample app.  Let me know if the component is useful to you.  I will provide an answer if it is...

JB
0
 
LVL 5

Expert Comment

by:JimBob091197
Comment Utility
I got a "Return Receipt" message in Outlook when I mailed you.  I don't know if this means you didn't get the mail...  Please let me know at "davekw@iafrica.com" if you get the mail.

JB
0
 
LVL 5

Accepted Solution

by:
JimBob091197 earned 100 total points
Comment Utility
I am glad that ShBrowseForFolder worked for you.
JB
0

Featured Post

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

772 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now