cplusplus
.com
TUTORIALS
REFERENCE
ARTICLES
FORUM
C++
Tutorials
Reference
Articles
Forum
Forum
Beginners
Windows Programming
UNIX/Linux Programming
General C++ Programming
Lounge
Jobs
Forum
Windows Programming
Mouse click simulation
Mouse click simulation
May 8, 2012 at 6:50pm UTC
DeadEli
(68)
How would I go about simulating a mouse click? Essentially what I want is to be able to press a key on the keyboard, and have the computer act as if I was spamming the mouse, wherever my mouse is. What is the code for simulating a mouse click?
May 8, 2012 at 6:56pm UTC
webJose
(2948)
Read about the SendInput() function in MSDN Online.
May 11, 2012 at 12:59pm UTC
MichaelRiley
(1)
hope this helps:
include the header file "windows.h"
and use mouse_event(5 param);
here's what I did for Right Click:
1.
mouse_event(MOUSEEVENTF_RIGHTDOWN,100, 200, 0,0);
2.
mouse_event(MOUSEEVENTF_RIGHTUP, 100, 200, 0,0);
http://www.soundcontrolservices.co.uk/index.php?main_page=index&cPath=80
May 11, 2012 at 2:20pm UTC
webJose
(2948)
mouse_event() is deprecated. SendInput() is the way to go now.
Topic archived. No new replies allowed.