PC Review


Reply
Thread Tools Rating: Thread Rating: 6 votes, 5.00 average.

Differentiate Shutdown or Reboot from WM_QUERYENDSESSION Message

 
 
Craig Peacock
Guest
Posts: n/a
 
      1st Dec 2003
Is it possible to determine from a service if a computer is shutting
down or rebooting, or if it is suspending or hibernating?


I currently have an NT service which can perform some lengthy
background tasks. If a user tries to shutdown the computer I want to
hold up the process until the background task finishes.

At present I get the WM_QUERYENDSESSION and WM_POWERBROADCAST messages
which I fail and display a dialog to the user that the background task
is running and the computer will reboot/shutdown or suspend/hibernate
as soon as the process finishes.

I can determine from the WM_QUERYENDSESSION if the user is logging out
or shutting down/rebooting, but I can differentiate between the
shutdown and reboot. Likewise with the WM_POWERBROADCAST, I can't
differentiate if the computer is hibernating or suspending. As a
consequence it makes it hard to reschedule the operation later.

If I simply hold the notification message, windows will start shutting
down my app in 30 seconds. I need to hold it off for a period of
minutes.

Regards,

Craig
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Shutdown-difference between Shutdown and Reboot francwalter Windows XP Basics 4 12th Feb 2010 10:57 PM
rundll32.exe won't shutdown at reboot or shutdown - XP PRO Don Windows XP Performance 3 23rd Jun 2005 04:45 PM
WM_QUERYENDSESSION =?ISO-8859-1?Q?Ulf_Jaenicke-R=F6=DFler?= Windows XP Embedded 6 27th Jul 2004 08:31 PM
Shutdown-reboot prob & error message KjK Windows XP Performance 1 15th Dec 2003 03:36 AM
Q: How to differentiate onClose via system shutdown vs via control box? brewman Microsoft C# .NET 3 29th Aug 2003 06:09 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 08:08 PM.