回调函数,可以看看。#include <GUIConstants.au3>
#include <FILE.AU3>
#include <date.au3>
#RequireAdmin
$log = @ScriptDir & "\A.LOG"
;Global $WM_POWERBROADCAST = 536
Global $PBT_APMRESUMESUSPEND = 0x0007
Global $PBT_APMRESUMESTANDBY = 0x0008
Global $PBT_APMPOWERSTATUSCHANGE = 0xA
Global $PBT_APMRESUMEAUTOMATIC = 0x12
Global $PBT_APMSUSPEND = 0x4
Global $PBT_POWERSETTINGCHANGE = 0x8013
$hGUI = GUICreate("Test", 100, 100,1,1)
GUIRegisterMsg(536, "Standby")
While 1
Sleep(10)
WEnd
Func Standby($hWnd, $Msg, $wParam, $lParam)
ConsoleWrite(_NowTime() & ": " & $wParam & @LF)
Select
Case $wParam = $PBT_APMRESUMESUSPEND
_FileWriteLog($log," You just woke up from Suspend." & @LF)
Case $wParam = $PBT_APMRESUMESTANDBY
_FileWriteLog($log," You just woke up from Standby." & @LF)
Case $wParam = $PBT_APMPOWERSTATUSCHANGE
_FileWriteLog($log,"Power status has changed."& @LF)
Case $wParam = $PBT_APMRESUMEAUTOMATIC
_FileWriteLog($log,"Operation is resuming automatically from a low-power state. This message is sent every time the system resumes."& @LF)
Case $wParam = $PBT_APMSUSPEND
_FileWriteLog($log,"System is suspending operation."& @LF)
Case $wParam = $PBT_POWERSETTINGCHANGE
_FileWriteLog($log,"A power setting change even"& @LF)
Case Else
EndSelect
EndFunc
|