Trapping Drive Not Ready message
Jim Tannenbaum -- jimt1@voicenet.com
Tuesday, January 07, 1997
Environment: MSVC 4.0 Win95
In the old DOS days, I wrote a critical interrupt handler to handle the
Drive Not Ready (Abort, Retry, Fail) problem when the user didn't close the
drive door.
Is there a similar method under MFC? Does try catch handle DOS critical errors?
TIA
Jet
JJM Systems, Inc Phone: (215) 672-3660
1 Ivybrook Blvd, Suite 190 Fax: (215) 672-5702
Ivyland, PA 19874 Net: jimt1@voicenet.com
Charles Prineas -- onramp@magna.com.au
Wednesday, January 08, 1997
>In the old DOS days
Oh - those were the days!
>I wrote a critical interrupt handler to handle the
>Drive Not Ready (Abort, Retry, Fail) problem when the user didn't close the
>drive door.
>Is there a similar method under MFC? Does try catch handle DOS critical
>errors?
You can probably handle this in one of three ways:
1. You can call the SetErrorMode() function to disable the Error Box.
Call it as follows:
SetErrorMode(SEM_FAILCRITICALERRORS);
Any function that fails will now return a Windows error code that you
will have to check for (rather than raise an exception).
2. Put a try/catch around any code that may raise an exception. This way you
will get to handle the exception before Windows does.
3. Set your own exception handler by calling SetUnhandledExceptionFilter().
Any exception that you don't want to handle should be passed on to
Windows by calling UnhandledExceptionFilter().
Regards, | Resources for REAL Programmers
Charles Prineas | http://www.prineas.com/
Mike Blaszczak -- mikeblas@nwlink.com
Wednesday, January 08, 1997
[Mini-digest: 5 responses]
At 19:48 1/7/97 -0500, Jim Tannenbaum wrote:
>Environment: MSVC 4.0 Win95
>In the old DOS days, I wrote a critical interrupt handler to handle the
>Drive Not Ready (Abort, Retry, Fail) problem when the user didn't close the
>drive door.
>Is there a similar method under MFC?
No. Windows handles the situation directly; see the ::SetErrorMode() API
documentation.
>Does try catch handle DOS critical errors?
While you're running Windows 95, DOS isn't involved in this activity.
>TIA
BMAHT.
.B ekiM
http://www.nwlink.com/~mikeblas/
Why does the "new" Corvette look like a 1993 RX-7?
These words are my own. I do not speak on behalf of Microsoft.
-----From: David Lowndes
>In the old DOS days, I wrote a critical interrupt handler to handle the
Drive Not Ready (Abort, Retry, Fail) problem when the user didn't close
the
drive door.
<
Use SetErrorMode( SEM_FAILCRITICALERRORS ) to prevent the system
message box report of the error. You may also need to specify
SEM_NOOPENFILEERRORBOX too.
>
-----From: "Simon Hunt"
Try SetErrorMode (SEM_FAILCRITICALERRORS)
Remember to restore the original setting after accessing the drive.
------------------------------------------------------------
Simon Hunt, Director
Challenge Computer Systems Pty. Ltd.
Postal: 4 Victoria Street, Mile End, South Australia 5031
Phone: +61 8 8351 7333 Fax: +61 8 8351 7101
Email: slhunt@ozemail.com.au
------------------------------------------------------------
----------
> From: Jim Tannenbaum
> To: mfc-l@netcom.com
> Subject: Trapping Drive Not Ready message
> Date: Wednesday, 8 January 1997 11:18 AM
>
>
> Environment: MSVC 4.0 Win95
>
> In the old DOS days, I wrote a critical interrupt handler to handle the
> Drive Not Ready (Abort, Retry, Fail) problem when the user didn't close
the
> drive door.
>
> Is there a similar method under MFC? Does try catch handle DOS critical
errors?
>
> TIA
>
> Jet
>
> JJM Systems, Inc Phone: (215) 672-3660
> 1 Ivybrook Blvd, Suite 190 Fax: (215) 672-5702
> Ivyland, PA 19874 Net: jimt1@voicenet.com
>
>
-----From: Mario Contestabile
>In the old DOS days, I wrote a critical interrupt handler to handle the
>Drive Not Ready (Abort, Retry, Fail) problem when the user didn't close the
>drive door.
>
>Is there a similar method under MFC? Does try catch handle DOS critical
errors?
SEH under Win32 handles hardware and software exceptions.
You can probably catch a CFileException.
mcontest@universal.com
-----From: hou@tfn.com (Bing Hou)
Yes, the try-catch will give you something like this:
TRY
{
CFile afile("a:\\test.txt", CFile::modeRead);
}
CATCH(CFileException, e)
{
if(e->m_cause == CFileException::accessDenied)
TRACE("Error code %d\n", (int)e->m_lOsError);
}
END_CATCH
-Bing
______________________________ Reply Separator _________________________________
Subject: Trapping Drive Not Ready message
Author: jimt1@voicenet.com (Jim Tannenbaum) at Internet
Date: 1/7/97 7:48 PM
Environment: MSVC 4.0 Win95
In the old DOS days, I wrote a critical interrupt handler to handle the
Drive Not Ready (Abort, Retry, Fail) problem when the user didn't close the
drive door.
Is there a similar method under MFC? Does try catch handle DOS critical errors?
TIA
Jet
JJM Systems, Inc Phone: (215) 672-3660
1 Ivybrook Blvd, Suite 190 Fax: (215) 672-5702
Ivyland, PA 19874 Net: jimt1@voicenet.com
| Вернуться в корень Архива
|