You are here:

C++/mouse emulation in C++



1- TO begin with, i am using microsoft visual C++ 6.0. Win XP. pentium 3/4 procesor. (intel 80x86)

2- What I am trying to do is to emulate the left mouse click using C++. I haven't tried anything yet cuz i don't know how do it.(but i have C++ experince).


4- I want the program to initiate a mouse click and then another mouse click after a certain number of seconds (that the user specifies) from the first.

Thanks in advance (salaf)

emad, Thank you for your question.

Although you can send any of the mouse messages directly to any window using the PostMessage function, you probably want to generate a system-level mouse event. You can do this using the SendInput function.

You can search Microsoft's MSDN Library at

If you have further questions, please do not hesitate to ask.

David Spector


All Answers

Answers by Expert:

Ask Experts


David Spector


Highly knowledgeable in the C++ language, Visual C++ (MSVC), Windows API, documentation and other quality-assurance techniques, and debugging. Knowledgeable in MFC, COM, GUI design, and object-oriented design.


I have been a software engineer since 1965. I have been published. My specializations have been: biomedical programming, compiler implementation, and many kinds of Windows programming. I don't do Databases or other business-oriented stuff.

Windows?/DOS Developer's Journal, ACM SIGPLAN Notices, and Computer Science Press.

ICCP Systems Programming Certification
Master's degree equivalent in Computer Science

©2017 All rights reserved.