Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
TRY-CATCH Error handling with Floppy Disk
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
01284220
Message ID:
01284254
Views:
12
>See also How to check if drive is ready FAQ #15764 (used to be relevant).
>

That worked! I used the code and modified it to be like this....
*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
*TMT


**************************************************

* 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)
*-- Test the FoxPro DISKSPACE() function.  If you get a -1, then
*-- there is no disk in the drive.
	IF DISKSPACE("a:",1) = -1
   		MESSAGEBOX("No floppy disk present or insufficient space to save.",0,"Floppy Disk Error")	
	ELSE 
		COPY FILE (lcSource) TO (lcDest)
	ENDIF
*-- Restore system error handling settings.
	= SetErrorMode(lnOldMode)
*TMT
	DELETE FILE (lcSource)
ENDIF
But.......... this assumes the API will not be changed by Microsoft in the future.....

Hopefully, it won't....
Tommy Tillman A+ NetWork+ MCP
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform