Solved

Handling EInOutError

Posted on 1997-10-19
8
675 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 100 total points
ID: 1348161
I am glad that ShBrowseForFolder worked for you.
JB
0

Featured Post

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!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
how to center only a line in richedit? 4 78
Show Listview image from database (String field) 5 188
select query - oracle 16 103
Delphi: ForceDirectory plain function 7 86
A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
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…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…
Attackers love to prey on accounts that have privileges. Reducing privileged accounts and protecting privileged accounts therefore is paramount. Users, groups, and service accounts need to be protected to help protect the entire Active Directory …

751 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