User forums > Help

How to simulate a click of LMB in c ++?

(1/1)

poundei:
Please tell me how to simulate clicking LMB.

When I specify 'VK_TAB' or 'keyboard character' then everything works
but when I enter VK_LBUTTON nothing happens. Why is that?

After all, if you had written the wrong name for the button, the program would not have compiled at all.

Here is the code:

--- 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;
}
--- End code ---

oBFusCATed:
This is not the correct forum for such questions...

Navigation

[0] Message Index

Go to full version