The windows messages you can check for are WM_ENDSESSION and
WM_QUERYENDSESSION. You'll need
    procedure WmEndSession(var Msg: TWMEndSession); message WM_ENDSESSION;
    procedure WmQueryEndSession(var Msg: TWMQueryEndSession); message
WM_QUERYENDSESSION;

You can still get a chance to say no by returning 0 to
TWMQueryEndSession.Result

Joe

-----Original Message-----
> This was a bug in Delphi 5 but this was fixed in D6 or D7.  My issue was
> mainly with the shutting down of the PC.  The same problem occured where
> no FormCloseQuery or FormClose was being performed.

> There is a work around by trapping the specific windows message
> manually, but someone else will need to tell you what it is.

> Ross.

> ----- Original Message -----
> This is the first time I notice that FormClose event is not
> fired when a user logs out and all the applications are closed.
> I'm not sure what the exact behavior is but it seemed natural
> to me to expect FormClose event when logging out a user. FormClose
> event handler is where I typically put the clean up code.

> FormDestroy is called though. I'll have to move some of the
> clean up code to this event. What's missing in FormDestroy is
> that you won't get a chance to say no, because it doesn't have
> the var Action: TCloseAction parameter. Now that I have to scatter
> the clean up code, this part of the code looks a little untidy
> now. I wonder if anyone has a good idea how to handle this.

_______________________________________________
Delphi mailing list -> [email protected]
http://www.elists.org/mailman/listinfo/delphi

Reply via email to