What I do (admittedly in a VC app) is implement both WM_QUERYENDSESSION and WM_ENDSESSION. On WM_QUERYENDSESSION I just return TRUE (so it's probably unnecessary) and on WM_ENDSESSION I do the exit and tidy up code.
So I suspect it's WM_ENDSESSION you want to do your processing in, not WM_QUERYENDSESSION. Regards, Bevan -------Original Message--------- From:"Robert martin" <[EMAIL PROTECTED]> To:"NZ Borland Developers Group - Delphi List" <[EMAIL PROTECTED]> Cc: Subject:Re: [DUG] Running events on shutdown Date:Fri, 30 Jan 2004 12:01:06 +1300 Why don't you stop the shutdown, do your processing and then initiate a n= ew shutdown message? Rob Martin Software Engineer phone 03 377 0495 fax 03 377 0496 web www.chreos.com ----- Original Message -----=20 From: "Steve Aish" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Friday, January 30, 2004 11:43 AM Subject: Re: [DUG] Running events on shutdown Update: After more investigation it seems that these do actually work on shut dow= n (but not log off). If I put in a message box in the WMQueryEndSession procedure it pops up. Also the other ones I mentioned. The problem is t= hat the procedure that needs to run takes approx half a second to 1 =BD secon= ds to run. If there are 3 other programs running the procedure has enough time= to searchthe database, update a record and close (yay). If there is nothing else open windows closes before the code has a chance to run so therefore= it doesn't seem to work. So 1. Is there a similar thing that works for Log Off (WMQueryLogOff or something???) 2. Is there a way I can say WAIT to the shut down of windows? I know I c= an say STOP but that doesn't really help me. I still want the PC to shut do= wn. Just not as fast... Steve >>> [EMAIL PROTECTED] 30/01/2004 11:09:32 a.m. >>> I have a program that runs some code when you close it down. Basically to tell the server that it is shut down properly. I also want this code to run if the user logs off or shuts down the PC without closing down the program. I am having heaps of trouble getting this to work. I have searched the internet and found a couple of ways of doing this but none actually seem to work for me. 1. use the OnCloseQuery on the main form. Using this I can actually stop windows closing down (yay) but if I put code in here it doesn't seem to run before shutting the computer down. 2. Capture the WMQueryEndSession message from windows Seems to either a : Run the tidy up code and stop windows from shutting down or b: Let windows shut down but don't run the code Does anyone have any pointers on this? Any ideas what I might be doing wrong. The program runs over a sockets connection using midas... All I am trying to do is run a couple or queries (search for a record - then update this record) Steve _______________________________________________ Delphi mailing list [EMAIL PROTECTED] http://ns3.123.co.nz/mailman/listinfo/delphi _______________________________________________ Delphi mailing list [EMAIL PROTECTED] http://ns3.123.co.nz/mailman/listinfo/delphi _______________________________________________ Delphi mailing list [EMAIL PROTECTED] http://ns3.123.co.nz/mailman/listinfo/delphi
_______________________________________________ Delphi mailing list [EMAIL PROTECTED] http://ns3.123.co.nz/mailman/listinfo/delphi
