Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Handling EInOutError

Posted on 1997-10-19
8
Medium Priority
?
683 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
Industry Leaders: 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 400 total points
ID: 1348161
I am glad that ShBrowseForFolder worked for you.
JB
0

Featured Post

New benefit for Premium Members - Upgrade now!

Ready to get started with anonymous questions today? It's easy! Learn more.

Question has a verified solution.

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

This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
Suggested Courses

722 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