NGen
November 1st, 2009, 06:35 PM
I'm currently trying to generate keyboard input for the Caps Lock, Num Lock, and Scroll Lock keys using SendInput. The input wasn't being sent, so I used GetError and looked up the error returned, which ended up meaning that the parameters used were invalid. Could someone figure out what my error is? I've been searching for half an hour, and I can't find anything.
INPUT Input[2];
ZeroMemory ( Input, sizeof ( Input ) );
Input[0].type = ( Input[1].type = INPUT_KEYBOARD );
Input[0].ki.wVk = Input[1].ki.wVk = VK_CAPITAL;
Input[1].ki.dwFlags = KEYEVENTF_KEYUP;
SendInput ( 2, Input, sizeof ( Input ) );
INPUT Input[2];
ZeroMemory ( Input, sizeof ( Input ) );
Input[0].type = ( Input[1].type = INPUT_KEYBOARD );
Input[0].ki.wVk = Input[1].ki.wVk = VK_CAPITAL;
Input[1].ki.dwFlags = KEYEVENTF_KEYUP;
SendInput ( 2, Input, sizeof ( Input ) );