Sign in to follow this  
Followers 0
E1M1

Why This code doesnt work on paint?

1 post in this topic

#1 ·  Posted (edited)

I cant find out why that code doesnt work on paint. It should draw dot there.

It just dont click. I used it few months ago on other app, then it worked, but now paint is problematic. Any ideas?

Opt("MouseCoordMode", 0)
Opt("WinTitleMatchMode", 2)
_MouseClickMinimized("untitled - Paint", "left", 500, 500)

Func _MouseClickMinimized($window, $Button = "left", $X = "", $y = "", $Clicks = 1)
;~  ConsoleWrite("Window: "&$window&" Button "&$Button&" X "&$x&" y "&$y&@CRLF)
    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 = "right"
            $Button = $MK_RBUTTON
            $ButtonDown = $WM_RBUTTONDOWN
            $ButtonUp = $WM_RBUTTONUP
        Case $Button = "left"
            $Button = $MK_LBUTTON
            $ButtonDown = $WM_LBUTTONDOWN
            $ButtonUp = $WM_LBUTTONUP
        Case Else
            Exit
    EndSelect
    If $X = "" Or $y = "" Then
        Exit
    EndIf
    For $i = 1 To $Clicks
        DllCall("user32.dll", "int", "SendMessage", _
                "hwnd", WinGetHandle($window), _
                "int", $WM_MOUSEMOVE, _
                "int", 0, _
                "long", _MakeLong($X, $y))
        DllCall("user32.dll", "int", "SendMessage", _
                "hwnd", WinGetHandle($window), _
                "int", $ButtonDown, _
                "int", $Button, _
                "long", _MakeLong($X, $y))
        DllCall("user32.dll", "int", "SendMessage", _
                "hwnd", WinGetHandle($window), _
                "int", $ButtonUp, _
                "int", $Button, _
                "long", _MakeLong($X, $y))
    Next
EndFunc   ;==>_MouseClickMinimized

Func _MakeLong($LoWord, $HiWord)
    Return BitOR($HiWord * 0x10000, BitAND($LoWord, 0xFFFF))
EndFunc   ;==>_MakeLong
Edited by E1M1

edited

Share this post


Link to post
Share on other sites



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 account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0