Click to See Complete Forum and Search --> : Simulating Keyboard Input Error


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 ) );

GameZelda
November 7th, 2009, 07:50 PM
ZeroMemory ( Input, sizeof ( Input ) );

Not sure if that causes the problem, but you're just clearing one structure.