Prevent System from sleep mode
-
I want to prevent or wake up my system from sleep mode programmatically using C++. I'm using SetThreadExecution() but its not working().http://msdn.microsoft.com/en-us/library/windows/desktop/aa373208%28v=vs.85%29.aspx[^] Do anyone having any idea how to do it?
-
I want to prevent or wake up my system from sleep mode programmatically using C++. I'm using SetThreadExecution() but its not working().http://msdn.microsoft.com/en-us/library/windows/desktop/aa373208%28v=vs.85%29.aspx[^] Do anyone having any idea how to do it?
Calling
SetThreadExecutionState(ES_CONTINUOUS | ES_SYSTEM_REQUIRED);
should prevent the system from entering the sleep mode. Waking a system up requires that the user initiates a wake-up event like pressing the power button, a keyboard key, or moving the mouse.
-
Calling
SetThreadExecutionState(ES_CONTINUOUS | ES_SYSTEM_REQUIRED);
should prevent the system from entering the sleep mode. Waking a system up requires that the user initiates a wake-up event like pressing the power button, a keyboard key, or moving the mouse.
Jochen Arndt wrote:
Calling
SetThreadExecutionState(ES_CONTINUOUS | ES_SYSTEM_REQUIRED);
should prevent the system from entering the sleep mode.
Its not working in my code..Is there any other method or trick to call it?
Jochen Arndt wrote:
Waking a system up requires that the user initiates a wake-up event like pressing the power button, a keyboard key, or moving the mouse.
I want to do it programmatically. Will you suggest something?
-
Jochen Arndt wrote:
Calling
SetThreadExecutionState(ES_CONTINUOUS | ES_SYSTEM_REQUIRED);
should prevent the system from entering the sleep mode.
Its not working in my code..Is there any other method or trick to call it?
Jochen Arndt wrote:
Waking a system up requires that the user initiates a wake-up event like pressing the power button, a keyboard key, or moving the mouse.
I want to do it programmatically. Will you suggest something?
Indian Coder1989 wrote:
Its not working in my code..Is there any other method or trick to call it?
This is the only way I know. It may help to repeat the call in regular intervals (e.g every 5 minutes).
Indian Coder1989 wrote:
I want to do it programmatically. Will you suggest something?
There is nothing to suggest because the CPU is usually not powered or in halt state when the system is in sleep mode. There must be an external event to wake-up.
-
Indian Coder1989 wrote:
Its not working in my code..Is there any other method or trick to call it?
This is the only way I know. It may help to repeat the call in regular intervals (e.g every 5 minutes).
Indian Coder1989 wrote:
I want to do it programmatically. Will you suggest something?
There is nothing to suggest because the CPU is usually not powered or in halt state when the system is in sleep mode. There must be an external event to wake-up.
Jochen Arndt wrote:
This is the only way I know. It may help to repeat the call in regular intervals (e.g every 5 minutes).
I made it using a timer and its working now. Can I do it for a period of time for which my application is running? Because its only working on a period of my timer.
-
Jochen Arndt wrote:
This is the only way I know. It may help to repeat the call in regular intervals (e.g every 5 minutes).
I made it using a timer and its working now. Can I do it for a period of time for which my application is running? Because its only working on a period of my timer.
I did not really understand what you mean now. Normally, the system should not go to sleep when an application has requested this until the application terminates or clears the state. But these links may be helpful: System Sleep Criteria[^] System Wake-up Events[^]