Dae Posted December 31, 2006 Posted December 31, 2006 (edited) I've been trying to send a mouse click to a game and in Winspector it's coming out differently than me actually clicking with my mouse. What I'm attempting is to send a FAKE mouse click through a DLL call to the game window. As you can see below, I've quoted the messages sent to the game window. "program click" messages are fake clicks. Looks to be being sent, but a duplicate is being sent for some reason too. "natural click" messages are normal clicks. Is sent twice too, but the duplicate is a little different. WM_LBUTTONDOWN Buttons pressed: MK_LBUTTON Mouse coordinates: 32, 107 WM_LBUTTONDOWN Buttons pressed: MK_LBUTTON Mouse coordinates: 32, 107 WM_LBUTTONUP wParam: 0x00000001 lParam: COORD WM_LBUTTONUP wParam: 0x00000001 lParam: COORDWM_LBUTTONDOWN Mouse coordinates: 32, 107 WM_LBUTTONDOWN Buttons pressed: MK_LBUTTON Mouse coordinates: 32, 107 WM_LBUTTONUP wParam: 0x00000001 lParam: COORD WM_LBUTTONUP wParam: 0x00000000 lParam: COORD The first DLL call is the left mouse button down, and the second is the left mouse button up. The first WM_LBUTTONDOWN and the last WM_LBUTTONUP don't include 1 of the params. I can't figure out a way to change the duplicate of my message being sent. Any change I make is made in the duplicate. Is this some sort of preventative measure against fake mouse clicks? DllCall($user32, "long", "PostMessage", "hwnd", $hWnd, "int", 0x00000201, "int", 0x00000001, "long", $COORD) DllCall($user32, "long", "PostMessage", "hwnd", $hWnd, "int", 0x00000202, "int", 0x00000001, "long", $COORD) I'm so very close. Any help would be great! Thanks in advance. Edited January 2, 2007 by Dae
Outshynd Posted December 31, 2006 Posted December 31, 2006 Try 0 as the wParam of the 2nd PostMessage? You probably have already but that's all I can think of.
Dae Posted January 1, 2007 Author Posted January 1, 2007 Try 0 as the wParam of the 2nd PostMessage? You probably have already but that's all I can think of.Yeah I tried that. It doubles up and the duplicate is the same. If only I could change the duplicate.WM_LBUTTONDOWNButtons pressed: MK_LBUTTONMouse coordinates: 32, 107WM_LBUTTONDOWNButtons pressed: MK_LBUTTONMouse coordinates: 32, 107WM_LBUTTONUPwParam: 0x00000000lParam: COORDWM_LBUTTONUPwParam: 0x00000000lParam: COORD
Dae Posted January 1, 2007 Author Posted January 1, 2007 This works, so I need to know how AutoIT sends its mouse clicks with MouseClick: MouseClick("Left", 32, 107, 2)
Dae Posted January 2, 2007 Author Posted January 2, 2007 This works, so I need to know how AutoIT sends its mouse clicks with MouseClick: MouseClick("Left", 32, 107, 2) Any idea anyone?
Bert Posted January 2, 2007 Posted January 2, 2007 It does it with the coordinates of the mouse. (where it is on the screen) You may want to use winwaitactive to have it work. I was trying to follow what you were attempting, and I don't understand why you were using dll call at first, then trying the mouseclick. With the thing being sent twice, it looked to me (I could be compleatly wrong here) like you were sending the same command twice??? Take a look at MouseCoordMode. That may give you some direction. The Vollatran project  My blog: http://www.vollysinterestingshit.com/
Dae Posted January 2, 2007 Author Posted January 2, 2007 It does it with the coordinates of the mouse. (where it is on the screen) You may want to use winwaitactive to have it work. I was trying to follow what you were attempting, and I don't understand why you were using dll call at first, then trying the mouseclick. With the thing being sent twice, it looked to me (I could be compleatly wrong here) like you were sending the same command twice???Take a look at MouseCoordMode. That may give you some direction.I am not sending the same command twice. The first call is the left mouse button down, the second call is the left mouse button up. I don't know why the call goes through twice, but it just does with this game, and it doesn't seem to have a problem with that - normal mouse clicks go through twice also.I don't intend on making the window active for the mouse click.What I am attempting is to send a fake mouse click to the game window that is inactive and hidden.I'm aware what MouseClick() does. What I'm wondering is what the source does to send that mouse click with the MouseClick() function. A DLL call right? Probably in C#/C++/Java or something, but still, I'd like to know.
Dae Posted January 3, 2007 Author Posted January 3, 2007 Anyone figure out how to send fake mouse clicks to games?
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