Welcome to Vista Banter. You are currently viewing our boards as a guest which gives you limited access to view most discussions, articles and access our other FREE features. By joining our free community you will have access to ask questions and reply to others posts, upload your own photos and access many other special features. Registration is fast, simple and absolutely free so please, join our community today! If you have any problems with the registration process or your account login, please contact contact support. |
|
Hardware and Windows Vista Hardware issues in relation to Windows Vista. (microsoft.public.windows.vista.hardware_devices) |
|
LinkBack | Thread Tools | Display Modes |
|
|||
Power Management in Windows Vista
Hi,
I want to develop an application for Windows Vista, which would detect Power button Press and stop the machine from shutting down or restarting or going into suspend mode. After investigation we found that when the machine is shutdown or restarted "WM_QUERYENDSESSION" message is sent to every process. However to trap this message we had to use SetProcessShutdownParameters with 3FF as the dwLevel. To stop the machine from shutting down I returned false when this message was detected, a dialog box asking the user whether to shutdown or not is prompted. Is there some way wherein this dailog box can be avoided and the shutdown process is directly cancelled. In case of Hibernate and Suspend we learned that wParam is returned as "PBT_APMQUERYSUSPEND" and "PBT_APMSUSPEND" . But even after using a trap handler for this we could not trap the event in Windows Vista. I am using SetThreadExecutionState() API with ES_CONTINUOUS parameters when "PBT_APMQUERYSUSPEND" and "PBT_APMSUSPEND" message is traped in WndProc() function for preventing the system from Hibernate and Suspend mode to go. Can you please let us know how to trap the Hibernate and Suspend event and mask the Hibernate and Suspend mode? Regards, Vikram |