Jump to content
Sign in to follow this  
Guest lufeng1204

Help for _MouseClickPlus

Recommended Posts

Guest lufeng1204

Hi, All

I tried to send mouse messages using _MouseClickPlus.

However I find it doesn't work while MouseClick works.

The code is as follows:

_MouseClickPlus("Calculator", "left", 256,162, 4) in the code

does't send the mouse click messages but MouseClick("left", 256, 162, 4).

My OP is Win XP home edition.

Is there any mistake I use MouseClickPlus?

Thanks for your help.

Opt("MouseCoordMode", 0)

Func _MouseClickPlus($Window, $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

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.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

Func _MakeLong($LoWord,$HiWord)

Return BitOR($HiWord * 0x10000, BitAND($LoWord, 0xFFFF))

EndFunc

WinWaitActive("Calculator")

$winsize = WinGetPos("Calculator")

Sleep (2000)

_MouseClickPlus("Calculator", "left", 256,162, 4)

;MouseClick("left", 256, 162, 4)

Share this post


Link to post
Share on other sites
Guest lufeng1204

mouseclickplus is a UDF User Defined Function

it is located here

http://www.autoitscript.com/forum/index.php?showtopic=7112#

it needs to be"included" in the top of your script

8)

<{POST_SNAPBACK}>

I have copyed the code of mouseclickplus on the top of my code.

You can read the code on my first post.

Is the usage correct?

Thanks

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  

×