so I am trying to implement the following code
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
|
void PressKey(WORD key, int x)
{
int y = 0;
while(y <= x)
{
SetForegroundWindow(eveWindow);
Sleep(200 + rand() % 250);
INPUT *keyClick;
keyClick = new INPUT;
keyClick->ki.wVk = key;
keyClick->type = INPUT_KEYBOARD;
keyClick->ki.dwFlags = 0;
keyClick->ki.time = 0;
keyClick->ki.wScan = 0;
keyClick->ki.dwExtraInfo = 0;
SendInput(1,keyClick,sizeof(INPUT));
Sleep(100);
keyClick->ki.dwFlags = KEYEVENTF_KEYUP;
SendInput(1,keyClick,sizeof(INPUT));
y++;
}
return 0;
}
|
but i get these errors
main.cpp: In function `void PressKey(WORD, int)':
main.cpp:79: error: `INPUT' was not declared in this scope
main.cpp:79: error: `keyClick' was not declared in this scope
main.cpp:80: error: `INPUT' is not a type
main.cpp:82: error: `INPUT_KEYBOARD' was not declared in this scope
main.cpp:89: error: `SendInput' was not declared in this scope
main.cpp:98: error: return-statement with a value, in function returning 'void'
make.exe[2]: *** [build/Debug/MinGW-Windows/main.o] Error 1
make.exe[2]: Leaving directory `/c/Users/John K. Hackett/Documents/NetBeansProjects/CppApplication_1'
make.exe[1]: *** [.build-conf] Error 2
make.exe[1]: Leaving directory `/c/Users/John K. Hackett/Documents/NetBeansProjects/CppApplication_1'
make.exe": *** [.build-impl] Error 2
BUILD FAILED (exit value 2, total time: 3s)