Jump to content
Sign in to follow this  

Why This code doesnt work on paint?

Recommended Posts

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
        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
    If $X = "" Or $y = "" Then
    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))
EndFunc   ;==>_MouseClickMinimized

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


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  

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Create New...