Code::Blocks Forums

User forums => Help => Topic started by: poundei on February 27, 2020, 05:20:36 am

Title: How to simulate a click of LMB in c ++?
Post by: poundei on February 27, 2020, 05:20:36 am
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;
}
Title: Re: How to simulate a click of LMB in c ++?
Post by: oBFusCATed on February 27, 2020, 09:02:22 am
This is not the correct forum for such questions...