Instead of sending 3 events of this in 3 separate sendinput() , I am trying to create an array of INPUT and use sendinput only once, as described here:
SendInput function (Windows)
Code:
#include <iostream>#include <windows.h>
#include <ctime>
using namespace std;
void main()
{
Sleep(3000);
INPUT input[3];
input[0].type = INPUT_MOUSE;
input[0].mi.dx = 0;
input[0].mi.dy = 0;
input[0].mi.dwFlags = MOUSEEVENTF_RIGHTDOWN;
input[0].mi.time = 10;
input[1].type = INPUT_MOUSE;
input[1].mi.dx = 100;
input[1].mi.dy = 0;
input[1].mi.dwFlags = MOUSEEVENTF_MOVE;
input[1].mi.time = 10;
input[2].type = INPUT_MOUSE;
input[2].mi.dx = 0;
input[2].mi.dy = 0;
input[2].mi.dwFlags = MOUSEEVENTF_RIGHTUP;
input[2].mi.time = 0;
SendInput(3, &input, sizeof(input));
return;
}
But I am getting this error:
argument of type "INPUT (*)[3]" is incompatible with parameter of type "LPINPUT"
How do I construct the array properly?
thx!