1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44
|
#include <windows.h>
#include <winuser.h>
#include <iostream>
#include <conio.h>
int x;
int y;
void left_click()
{
mouse_event(MOUSEEVENTF_LEFTDOWN, x, y, 0, 0);
mouse_event(MOUSEEVENTF_LEFTUP,x,y,0,0);
}
void right_click()
{
mouse_event(MOUSEEVENTF_RIGHTDOWN, x, y, 0, 0);
mouse_event(MOUSEEVENTF_RIGHTUP, x, y, 0, 0);
}
int main (){
bool bDone = false;
char cInput;
while (bDone == false){
cInput = _getch();
switch (cInput) {
case 'a':
case 'A':
left_click();
break;
case 's':
case 'S':
right_click();
break;
case 'q':
case 'Q':
bDone = true;
break;
}
}
return 0;
}
|