helloamit78
September 13th, 2001, 05:56 AM
I want to make an application that would run in the background and trap the Windows Shut Down event to call a function.
|
Click to See Complete Forum and Search --> : Windows Shut Down Event helloamit78 September 13th, 2001, 05:56 AM I want to make an application that would run in the background and trap the Windows Shut Down event to call a function. DSJ September 13th, 2001, 08:07 AM Take a look at the second parameter to the Form QueryUnload event... Cimperiali September 13th, 2001, 08:40 AM Dsj means: When shutting down, windows gives a quit (=unload all form and close) command to all opened programs. If your program run hidden, it will trig the Query_unload event (with an integer value you have to check as I do not remember right now). Matter is: if user terminate your program via Program Manager (on winnt) or hitting ctrl+alt+canc and selecting your program in the list of active task, you may or may not have triggered the query_unload, but Windows may not being shutting down... Special thanks to Lothar "the Great" Haensler, Tom Archer, Chris Eastwood, TCartwright, Bruno Paris, Dr_Micahel and all the other wonderful people who made and make Codeguru a great place. Come back soon, you Gurus. The Rater Cimperiali September 13th, 2001, 08:45 AM Sorry: hitted submit and Ok too fast... Now, you may want to call that function on startup of windows, in case you cannot trig the shut down of it: you may do this writing two programs: one should start always at startup (search for run key in registry) and trig on query_unload just to write a new string in RunOnce key of registry. The second should only call the function. The string to write in the RunOnce Key is the path and name + extension of your second exe. This will do the trick: at startup, your second exe will be called, thus activating your function.... Special thanks to Lothar "the Great" Haensler, Tom Archer, Chris Eastwood, TCartwright, Bruno Paris, Dr_Micahel and all the other wonderful people who made and make Codeguru a great place. Come back soon, you Gurus. The Rater codeguru.com
Copyright Internet.com Inc., All Rights Reserved. |