Mouse click simulation

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?
Read about the SendInput() function in MSDN Online.
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
mouse_event() is deprecated. SendInput() is the way to go now.
Topic archived. No new replies allowed.