Re:Detecting Windows Shutdown??
"Roger C. Spaeder" <spae...@ix.netcom.com> wrote:
Quote
>I'm trying to figure out how to detect Windows 95 shutdown from within
>a Delphi 2.0 application, for example, from within the OnCloseQuery
>event handler. Unlike Visual Basic, Delphi's OnCloseQuery handler does
>not pass a parameter reporting the cause of the close form event, e.g.,
>to distinguish between a form closing prompted by user clicking on a
>system menu vs. shutdown of a Windows session. Does one have to write
>an event handler to detect the WM_ENDSESSION message or some similar
>message? Your suggestions would be appreciated.
You must do a lot to detect this.
You have to Hook the MainWindow from your application. There is a
function to do this "HookMainWindow". Look up this function in the
help to figure out, what to pass. Then you can intercept the
WM_ENDSESSION message correctly and do any cleanup you need. Make sure
you set the flags in a way that delphi does not handle this message by
default, as it calls an immediate "Halt" and your application will go
away....
Hope this helps
Meik Weber
m.we...@public.ndh.com or
100744.3...@compuserve.com