虽然是直接抄的帮助文档,但我相信肯定还有很多菜鸟和我一样不知道,所以还是发一下比较好。#include <SendMessage.au3>
;利用Sendmessage可以关闭monitor
_Main()
Func _Main()
Local Const $Off = 2, $On = -1
Opt("WinTitleMatchMode", 4)
Local $hwnd = WinGetHandle('classname=Progman')
;关闭显示器和打开显示器
_ToggleMonitor($hwnd, $Off)
;三秒后打开显示器
Sleep(3000)
_ToggleMonitor($hwnd, $On)
EndFunc ;==>_Main
Func _ToggleMonitor($hwnd, $OnOff)
Local Const $WM_SYSCOMMAND = 274
Local Const $SC_MONITORPOWER = 61808
_SendMessage($hwnd, $WM_SYSCOMMAND, $SC_MONITORPOWER, $OnOff)
If @error Then
MsgBox(0, "_ToggleMonitor", "_SendMessage Error: " & @error)
Exit
EndIf
EndFunc ;==>_ToggleMonitor
|