*TMT 01/22/2008 *-- SetErrorMode determines whether the system handles *-- serious errors or whether the program handles them. #define SEM_FAILCRITICALERRORS 0x0001 DECLARE INTEGER SetErrorMode in win32api INTEGER *TMTThen later at the end of the method...
* If drive A is selected, copy to a and delete from c IF lcDrive == "A" lcSource = "c:\" + ALLTRIM(ThisForm.txtReportName.value) lcDest = "a:\" + ALLTRIM(ThisForm.txtReportName.value) ThisForm.txtStatus.value = "Copying to drive A:..." *-- SetErrorMode returns what the flags were last set. lnOldMode = SetErrorMode(SEM_FAILCRITICALERRORS) *-- Get the size of the DAT file on the C: drive root =ADIR(aDATs,lcSource) DO CASE *-- Test the FoxPro DISKSPACE() function. If you get a -1, then *-- there is no disk in the drive. CASE DISKSPACE("a:",1) = -1 MESSAGEBOX("No floppy-disk present or insufficient space to save.",0,"Floppy-Disk Error") *-- Test the free space on the floppy disk to the size of the DAT file on the C: root CASE DISKSPACE("a:") < aDATs(1,2) MESSAGEBOX("Insufficient space to save on floppy-disk. Please try another floppy-disk.",0,"Floppy-Disk Error") *-- Otherwise ok... save the file to the floppy disk... OTHERWISE TRY COPY FILE (lcSource) TO (lcDest) CATCH MESSAGEBOX("Cannot save to floppy-disk. Check write-protect on floppy.",0,"Floppy-Disk Error") FINALLY ENDTRY ENDCASE *-- Restore system error handling settings. = SetErrorMode(lnOldMode) *TMT DELETE FILE (lcSource) ENDIFI added a check for diskspace on the floppy and to check for the write-protect being on.