WM_POWERBROADCAST on Vista.
-
I am working on Vista with VS 2005. In my application, I am handling the WM_POWERBROADCAST message and in the message handlig function, execution some code which i must execute when the system goes to hibernate or standby(sleep) mode. I find that on Vista, windows doesnot wait for the WM_POWERBROADCAST message handling function to return a value(true or false) before proceeding to entering into sleep mode. On Vista, the system goes to sleep mode even before the WM_POWERBROADCAST message handling function returns a value. And because of this, my application does not have enough time to execute code in the handler function and results in a crash. Should Windows go/not go to hibernate/sleep mode depending on the return value of the WM_POWERBROADCAST handling function?[MSDN Link]
-
I am working on Vista with VS 2005. In my application, I am handling the WM_POWERBROADCAST message and in the message handlig function, execution some code which i must execute when the system goes to hibernate or standby(sleep) mode. I find that on Vista, windows doesnot wait for the WM_POWERBROADCAST message handling function to return a value(true or false) before proceeding to entering into sleep mode. On Vista, the system goes to sleep mode even before the WM_POWERBROADCAST message handling function returns a value. And because of this, my application does not have enough time to execute code in the handler function and results in a crash. Should Windows go/not go to hibernate/sleep mode depending on the return value of the WM_POWERBROADCAST handling function?[MSDN Link]
The following is from the documentation - To prevent the system from transitioning to a low-power state in Windows Vista, an application must call SetThreadExecutionState to inform the system that it is in use.
«_Superman_» I love work. It gives me something to do between weekends.
-
The following is from the documentation - To prevent the system from transitioning to a low-power state in Windows Vista, an application must call SetThreadExecutionState to inform the system that it is in use.
«_Superman_» I love work. It gives me something to do between weekends.
I tried calling the SetThreadExecutionState() function in the OnInitDialog() of an sample dialog based applicaiton with various combinations of flags ES_CONTINUOUS ES_SYSTEM_REQUIRED | ES_DISPLAY_REQUIRED, but to no avail. Could you please tell me as to which flag is to be used with SetThreadExecutionState()?
-
I tried calling the SetThreadExecutionState() function in the OnInitDialog() of an sample dialog based applicaiton with various combinations of flags ES_CONTINUOUS ES_SYSTEM_REQUIRED | ES_DISPLAY_REQUIRED, but to no avail. Could you please tell me as to which flag is to be used with SetThreadExecutionState()?
I guess you have to call
SetThreadExecutionState
inside theWM_POWERBROADCAST
handler.«_Superman_» I love work. It gives me something to do between weekends.
-
I guess you have to call
SetThreadExecutionState
inside theWM_POWERBROADCAST
handler.«_Superman_» I love work. It gives me something to do between weekends.
Tried adding the SetThreadExecutionState() funciton in the WM_POWERBROADCAST handling funciton but to no avail.