如何判断系统已经从睡眠或休眠状态下返回了[已解决]
本帖最后由 Neuis 于 2012-12-5 10:42 编辑例如程序让系统进入睡眠模式或休眠后,一直到等到用户手动唤醒后,程序会自行判断系统是否返回,然后为用户执行相应操作,如打开网页等。 回调函数,可以看看。
#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
回复 1# Neuis
楼主 休眠唤醒后 你没关闭的程序(包括网页)正常是在打开状态的。感觉 不必要执行什么操作吧 回复 2# MicroBlue
谢谢提点
页:
[1]