包装常用 DLL 调用
#Include <SendMessage.au3>
_SendMessage($hWnd, $iMsg [, $wParam = 0 [, $lParam = 0 [, $iReturn = 0 [, $wParamType = "wparam" [, $lParamType = "lparam" [, $sReturnType = "lparam"]]]]]])
$hWnd | 窗口或控件句柄 |
$iMsg | 发送到控件的消息(数字) |
$wParam | [可选参数] 指定附加消息的特定信息 |
$lParam | [可选参数] 指定附加消息的特定信息 |
$iReturn | [可选参数] 返回什么: 0 - 从 DLL 调用返回值 1 - $ihWnd 2 - $iMsg 3 - $wParam 4 - $lParam 4 - 与 dllcall 相同的数组 |
$wParamType | [可选参数] 查看相关的 DllCall |
$lParamType | [可选参数] 查看相关的 DllCall |
$sReturnType | [可选参数] 查看相关的 DllCall |
成功: | 返回用户选择 DllCall() 结果的值 | |
失败: | 设置@error: |
#include <SendMessage.au3>
_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(4096, "_ToggleMonitor", "_SendMessage Error: " & @error)
Exit
EndIf
EndFunc ;==>_ToggleMonitor