News:

When registered with our forums, feel free to send a "here I am" post here to differ human beings from SPAM bots.

Main Menu

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

Started by poundei, February 27, 2020, 05:20:36 AM

Previous topic - Next topic

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:
#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;
}


oBFusCATed

This is not the correct forum for such questions...
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]