>>>I have a small application that generally runs in the background. When I close Windows 95, the error message "cannot close Visual Fox Pro" comes up. I have to manually exit the program and then shut down. Is there a way to allow a VFP5 program to close automatically with Windows 95? I can't find anything in the documentation.
>>
>>David
>>
>>You need a program that runs ON SHUTDOWN DO
>>
>>This program should at least CLEAR EVENTS and perform any other tidying. It should also clear the ON SHUTDOWN program.
>>
>>HTH
>
>Thanks Ian, I hadn't noticed the ON SHUTDOWN command. I tried using it, in accordance with the online documentation, which said close tables, release forms and quit, and it hangs my system! Do you have an example of an ON SHUTDOWN procedure or program that has worked? I can't see what I'm doing wrong.
>
>David
I've noticed some problems in VFP where if certain DLL declarations are in effect, the QUIT command is unreliable. Early in your program, make the following declaration:DECLARE INTEGER ExitProcess IN Win32API ;
INTEGER ExitCode
Add the following line to fire the API call from ShutDown:
ON SHUTDOWN =ExitProcess(0)
Note: ExitProcess is CASE SENSITIVE in both its declaration and in referencing it.
hth