Question simulate mouse click

Zexor

Well-known member
Joined
Nov 28, 2008
Messages
513
Programming Experience
3-5
Is there a way to simulate a mouse click without first setting the cursor position then do a mouse event leftdown? sometime if i am moving my mouse during this event, the mouse won't be clicking where its suppose to be clicking.
 

jmcilhinney

VB.NET Forum Moderator
Staff member
Joined
Aug 17, 2004
Messages
14,726
Location
Sydney, Australia
Programming Experience
10+
Moving the mouse and clicking the mouse are separate Windows messages so there's no way to make the combined operation atomic at that level. Your best bet would be to use the SendInput API and combine the positioning and clicking data into a single call. If it's possible to prevent physical input being interleaved then that would do it. Note that mouse_event has been deprecated in favour of SendInput for many years.
 
Top Bottom