hendrikhe Posted August 16, 2014 Share Posted August 16, 2014 (edited) I used _MouseClickPlus() a time ago, but for some reason its not working anymore: ;----testing the function sleep(5000) _MouseClickPlus("Unbenannt - Editor", "left",1468,571,1) testing with the windows notepad editor, any ideias? Greetz hendrikhe expandcollapse popup;=============================================================================== ; ; Function Name: _MouseClickPlus() ; Version added: 0.1 ; Description: Sends a click to window, not entirely accurate, but works ; minimized. ; Parameter(s): $Window = Title of the window to send click to ; $Button = "left" or "right" mouse button ; $X = X coordinate ; $Y = Y coordinate ; $Clicks = Number of clicks to send ; Remarks: You MUST be in "MouseCoordMode" 0 to use this without bugs. ; Author(s): Insolence <insolence_9@yahoo.com> ; ;=============================================================================== opt("MouseCoordMode", 0) Func _MouseClickPlus($handle, $Button = "left", $X = "", $Y = "", $Clicks = 1) 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 Local $user32 = DllOpen("user32.dll") 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 If $X = "" OR $Y = "" Then $MouseCoord = MouseGetPos() $X = $MouseCoord[0] $Y = $MouseCoord[1] EndIf For $i = 1 to $Clicks DllCall($user32, "int", "SendMessage", "hwnd",$handle, "int", $WM_MOUSEMOVE, "int", 0, "long", _MakeLong($X, $Y)) DllCall($user32, "int", "SendMessage", "hwnd", $handle, "int", $ButtonDown, "int", $Button, "long", _MakeLong($X, $Y)) DllCall($user32, "int", "SendMessage", "hwnd", $handle, "int", $ButtonUp, "int", $Button, "long", _MakeLong($X, $Y)) Next EndFunc Func _MakeLong($LoWord,$HiWord) Return BitOR($HiWord * 0x10000, BitAND($LoWord, 0xFFFF)) EndFunc ;----testing the function sleep(5000) _MouseClickPlus("Unbenannt - Editor", "left",1468,571,1) Edited August 16, 2014 by hendrikhe Link to comment Share on other sites More sharing options...
Zedna Posted August 16, 2014 Share Posted August 16, 2014 (edited) 1) look at my MouseClickFast & MouseMoveFast '?do=embed' frameborder='0' data-embedContent>> 2) I think that problem can be in 64bit OS and probably wrong data types in DllCall() --> either try #AutoIt3Wrapper_UseX64=n or fix data types in DllCall() according to 32/64bit OS. See Helpfile for DllCall() - ptr/int_ptr/long_ptr You may use/look at _SendMessage() standard UDF - there are DllCalls() in correct way Edited August 16, 2014 by Zedna Resources UDF ResourcesEx UDF AutoIt Forum Search Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now