Solved

Handling EInOutError

Posted on 1997-10-19
8
679 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 2
8 Comments
 
LVL 5

Expert Comment

by:JimBob091197
ID: 1348154
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
ID: 1348155
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
ID: 1348156
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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 5

Expert Comment

by:JimBob091197
ID: 1348157
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
 
LVL 1

Author Comment

by:et
ID: 1348158
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
ID: 1348159
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
ID: 1348160
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
ID: 1348161
I am glad that ShBrowseForFolder worked for you.
JB
0

Featured Post

[Live Webinar] The Cloud Skills Gap

As Cloud technologies come of age, business leaders grapple with the impact it has on their team's skills and the gap associated with the use of a cloud platform.

Join experts from 451 Research and Concerto Cloud Services on July 27th where we will examine fact and fiction.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
There are cases when e.g. an IT administrator wants to have full access and view into selected mailboxes on Exchange server, directly from his own email account in Outlook or Outlook Web Access. This proves useful when for example administrator want…
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.
Suggested Courses
Course of the Month8 days, 5 hours left to enroll

617 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