>>>I use ExitProcess() to be able to test for an 'errorlevel' in the batchfile. As it is now, I can manage that it returns 2 if the app is quit via ESC or a Quit-button. It will produce no value (giving errorlevel 0) if there's an oncontrolled break (e.g. a crash) and in all other conditions a 1. This 1 is produced if the Windows Task Manager ends the app, but it is also produced if the CloseButton (see property Closeable) is chosen.
>>>
>>>
>>>* to the operating system when terminating. It can be done using a call to the
>>>* Win32 API call ExitProcess(). VFP will immediately terminate and will return
>>>* the value of the parameter as the error level.
>>>DECLARE ExitProcess in Win32API INTEGER ExitCode
>>>*
>>>* 0 = Uncontrolled break, for example a crash.
>>>* 1 = Quit via [x] in upperright corner or via Windows Task Manager.
>>>* 2 = Quit via Quit-button or via ESC.
>>>ExitProcess( iif( m.glUserQuit, 2, 1 ) )
>>>
>>>Who knows of a way to see that the CloseButton was pressed?
>>
>>Goedemiddag,
>>
>>I believe, if you are looking for the Close Button in the upper richt corner : this will instantiate the QueryUnload event, and to my knowledge the only one except in default situation.
>>
>>Hope this will give you the solution.
>
>Goedenavond ondertussen,
>
>The Windows Task Manager also 'visits' the QueryUnload.
Look at ReleaseType property in VFP Help.
If it's not broken, fix it until it is.
My Blog