PDA

View Full Version : Before shutdown



mnovak5
08-21-2001, 11:17 AM
There are at many ways to launch programmes after the system starts - the most common one being the Startup folder of Start menu. Is there an analogy of anything like this "before shutdown". I mean, is there any way to force Windows to execute programmes or scripts after you click Start > Shutdown and choose to switch off the computer? Or after you click on Yes after clicking Log off...

I know, there would be a way. To write a script and end it with rundll32.exe calling ExitWindows and the like but that's not what I want. I would simply like users to shutdown their computers as usual but I also want a short program to be executed after they do so.

RWSchlatter
08-21-2001, 05:00 PM
Create a small monitoring program EXE, that looks for the Windows shutdown messages in its main loop, and a DLL program that contains your actual shutdown code. When shutdown message is seen, call your dll for final processing. Note that your cleanup has only limited time before Windows ask if it may kill it. Possibly install the main program using the RunServices registry key.
Ref: <a target="_blank" href=http://msdn.microsoft.com/library/en-us/sysinfo/hh/sysmgmt/shutdown_2hir.asp?frame=true>http://msdn.microsoft.com/library/en-us/sysinfo/hh/sysmgmt/shutdown_2hir.asp?frame=true</a>

______________
Regards - Richard