我有这个代码发送鼠标动作到一个不活动的窗口,但我不知道为什么它不工作,它不给任何错误。包括部分是与<>,我删除了他们。在这个例子中,我想在油漆中画一条线。我还需要一个dll或au3文件的图像研究在最小化的窗口。我搜遍了整个网站,但没找到一个能用的。谢谢你的帮助。
include SendMessage.au3
Include WinAPI.au3
Global $wHandle = "Untitled - Paint"
ControlClickDrag($wHandle,"left",300,300,100,80)
Func ControlClickDrag($wHandle, $Button="left", $X1="", $Y1="", $X2="", $Y2="")
Local $MK_LBUTTON = 0x0001
Local $WM_LBUTTONDOWN = 0x0201
Local $WM_LBUTTONUP = 0x0202
Local $MK_RBUTTON = 0x0002
Local $WM_RBUTTONDOWN = 0x0204
Local $WM_RBUTTONUP = 0x0205
Local $WM_MOUSEMOVE = 0x0200
Local $i = 0
Select
Case $Button = "left"
$Button = $MK_LBUTTON
$ButtonDown = $WM_LBUTTONDOWN
$ButtonUp = $WM_LBUTTONUP
Case $Button = "right"
$Button = $MK_RBUTTON
$ButtonDown = $WM_RBUTTONDOWN
$ButtonUp = $WM_RBUTTONUP
EndSelect
DllCall("user32.dll", "int", "SendMessage", "hwnd", $wHandle, "int", $ButtonDown, "int", $Button, "long", _MakeLong($X1, $Y1))
DllCall("user32.dll", "int", "SendMessage", "hwnd", $wHandle, "int", $ButtonUp, "int", $Button, "long", _MakeLong($X2, $Y2))
EndFunc
Func _MakeLong($LoWord,$HiWord)
Return BitOR($HiWord * 0x10000, BitAND($LoWord, 0xFFFF))
EndFunc
Global $wHandle =" Untitled - Paint"
这不是句柄。它只是一个字符串。
替换为:
Global $wHandle = ControlGetHandle("Untitled - Paint", "",[CLASS:Afx:00007FF7B1BD0000:8; INSTANCE:1]")
您可以使用Au3Info.exe来获取为其他程序执行此操作所需的信息。