Article ID: 191501
Article Last Modified on 7/1/2004
170609 PRB: PUTFILE Command to Drive "A" Without a Floppy Causes Fault
*-- Code begins here.
*-- Defines from Winbase.h
#define SEM_FAILCRITICALERRORS 0x0001
#define SEM_NOGPFAULTERRORBOX 0x0002
#define SEM_NOALIGNMENTFAULTEXCEPT 0x0004
#define SEM_NOOPENFILEERRORBOX 0x8000
*-- SetErrorMode determines whether the system handles
*-- serious errors or whether the program handles them.
DECLARE INTEGER SetErrorMode in win32api INTEGER
*-- SetErrorMode returns to what the flags were last set.
*-- You need to store this in lnResult so that you can set them
*-- back the way they were before calling SetErrorMode.
*-- Failure to do so can produce unpredictable results
*-- when encountering future errors. SetErrorMode only
*-- applies to the current process and therefore only affects
*-- the FoxPro program that called SetErrorMode.
lnResult = SetErrorMode(SEM_FAILCRITICALERRORS)
*-- Test the FoxPro DISKSPACE() function. If you get a -1, then
*-- there is no disk in the drive.
IF DISKSPACE("a:") = -1
MESSAGEBOX("No disk present.", 0)
ELSE
MESSAGEBOX("Drive is ready.", 0)
ENDIF
*-- Put things back the way you found them.
lnResult = SetErrorMode(lnResult)
*-- Test DISKSPACE() again. If there is no floppy in the drive,
*-- a Windows NT system dialog box appears.
IF DISKSPACE("a:") = -1
MESSAGEBOX("No disk present.", 0)
ELSE
MESSAGEBOX("Drive is ready.", 0)
ENDIF
*-- Code ends here.
170609 PRB: PUTFILE Command to Drive "A" Without a Floppy Causes Fault
Additional query words: removable media kbVFp600 kbAPI kbVFp500a kbVFp500
Keywords: kbhowto KB191501