The biggest reason I don't do this is they might be restarting the system instead of shutting down. There is no way of telling. Also I was hoping it would handle logging off too...
>>> [EMAIL PROTECTED] 30/01/2004 12:01:06 p.m. >>> Why don't you stop the shutdown, do your processing and then initiate a new shutdown message? Rob Martin Software Engineer phone 03 377 0495 fax 03 377 0496 web www.chreos.com ----- Original Message ----- 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 down (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 that the procedure that needs to run takes approx half a second to 1 � seconds 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 can say STOP but that doesn't really help me. I still want the PC to shut down. 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
