Click to See Complete Forum and Search --> : Delay Windows shutdown
RoyceF
February 15th, 2008, 10:06 AM
I have a Windows service in which I need to detect the Windows shutdown event and, depending on what kind of processing I am doing at the time, delay the shutdown for a few seconds until my processing is complete. Can that be done?
Any help appreciated.
.pcbrainbuster
February 15th, 2008, 10:18 AM
I'm not a hundred percent sure but I think I recall a message(maybe WM_SYSCOMMAND) that returns a value in wParam that tells you that windows is shutting down... And if you return false it won't...
Marc G
February 16th, 2008, 09:34 AM
Handle WM_QUERYENDSESSION (http://msdn2.microsoft.com/en-us/library/aa376890(VS.85).aspx).
RoyceF
February 19th, 2008, 10:02 AM
Thanks everyone for the help. I know about the WM_QUERYENDSESSION message and how to handle it. Originally, I was looking for a way to get around the hidden window in my service, but because I have to interact with my user, I must use it. I found that the AbortShutdown() API function is what I need to use to delay the system shutdown.
codeguru.com
Copyright Internet.com Inc., All Rights Reserved.