LRESULT CALLBACK WindowProc( HWND hwnd, // handle to window UINT uMsg, // WM_POWER WPARAM wParam, // power-management event LPARAM lParam // function-specific data );
WM_POWERBROADCAST消息,可以很據wParam參數來判定,判斷睡眠喚醒只需PBT_APMRESUMESUSPEND和PBT_APMSUSPEND事件
Event | Meaning |
---|---|
PBT_APMBATTERYLOW | Battery power is low. |
PBT_APMOEMEVENT | OEM-defined event occurred.OEM定義的事件發生。 |
PBT_APMPOWERSTATUSCHANGE | Power status has changed. |
PBT_APMQUERYSUSPEND | Request for permission to suspend.申請許可暫停。 |
PBT_APMQUERYSUSPENDFAILED | Suspension request denied. |
PBT_APMRESUMEAUTOMATIC | Operation resuming automatically after event. |
PBT_APMRESUMECRITICAL | Operation resuming after critical suspension. |
PBT_APMRESUMESUSPEND | Operation resuming after suspension. |
PBT_APMSUSPEND | System is suspending operation. |