Answer the question
In order to leave comments, you need to log in
How to simulate left click in c++?
Please tell me how to simulate pressing LMB.
When I specify 'VK_TAB' or 'keyboard symbol' everything works, but when I enter VK_LBUTTON nothing happens. Why is that?
After all, if I had written the wrong button name, the program would not have compiled at all.
Here is the code:
#include <iostream>
#include <Windows.h>
#pragma comment(lib,"user32")
using namespace std;
int main()
{
string txt;
for(int i=0;i <100;i++ ){
keybd_event (VK_LBUTTON,0,0,0);
cout << i <<endl;
Sleep(100);
}
return 0;
}
Answer the question
In order to leave comments, you need to log in
> After all, if I wrote the wrong name of the button, then the program would not be compiled at all.
But no, it will still compile, since these enums are numbers in int.
keybd_event for keyboard and mouse_event for mice
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question