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
Solved

Handling EInOutError

Posted on 1997-10-19
8
671 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
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
Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Suggested Solutions

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…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

856 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