[This is preliminary documentation and subject to change.]
Your application can restore an On-Now capable computer that is in a sleeping state to the working state by using a scheduled time or a device event. This is known as a wake-up event. Use a waitable timer object to specify the time at which the system should wake. To create the object, use the CreateWaitableTimer function. To set the timer, use the SetWaitableTimer function. The pDueTime parameter specifies when the timer will be signaled. To specify that the system should wake when the timer is signaled, set the fResume parameter to TRUE.
Use the RequestDeviceWakeup function to enable the device's wake-up capability. You can have the system awaken after a modem ring, network request, or other device-based event. Your application should provide an interface for the user to specify the device wake-up, then use RequestDeviceWakeup.
When the system wakes automatically because of an event (other than power switch or user activity), the system automatically sets its idle timer to at least 1 minute. This timer allows applications to call the SetThreadExecutionState function to indicate that they are busy. This enables the system to shut down without affecting the user. The following criteria determine whether a system shutdown is needed:
When the system wakes automatically, the system sends the PBT_APMRESUMEAUTOMATIC message to all applications. Because the user is not present, most applications should do nothing. Event-handling applications, such as fax servers, should handle their events. If you wish to determine whether the system is in this state, call the IsSystemResumeAutomatic function.
If the system wakes due to user activity after sending PBT_APMRESUMEAUTOMATIC, the system sends the PBT_APMRESUMESUSPEND message and turns on the display. Your application should reopen files that it closed when the system entered the sleeping state, and it should prepare for user input.
If an application called SetSystemPowerState with fForce set to TRUE, no applications will receive the PBT_APMQUERYSUSPEND message when the system enters the sleeping state. If the system is carrying out a critical suspension, no applications will receive the PBT_APMQUERYSUSPEND or PBT_APMSUSPEND message; they will receive only the PBT_APMRESUMECRITICAL message.