我是这样理解的,不知道对不对,测试了下,好像没效果。。。
Global Const $WM_POWERBROADCAST = 0x218
Global Const $PBT_APMPOWERSTATUSCHANGE = 0xA
Global Const $PBT_APMRESUMEAUTOMATIC = 0x12
Global Const $PBT_APMRESUMESUSPEND = 0x7
Global Const $PBT_APMSUSPEND = 0x4
Global Const $PBT_POWERSETTINGCHANGE = 0x8013
GUICreate('My Test', 400, 300)
GUISetState()
GUIRegisterMsg($WM_POWERBROADCAST, 'My_Message_Test')
Do
Until GUIGetMsg() = -3
Func My_Message_Test($hWnd, $Msg, $wParam, $lParam)
Switch $wParam
Case $PBT_APMPOWERSTATUSCHANGE ;电源状态发生了变化。
MsgBox(0, $wParam, '电源状态发生了变化')
Case $PBT_APMRESUMEAUTOMATIC
Case $PBT_APMRESUMESUSPEND
Case $PBT_APMSUSPEND
Case $PBT_POWERSETTINGCHANGE
EndSwitch
EndFunc ;==>My_Message_Test
|