Try to use GetAsyncKeyState. I dunno if it works in your case, but it's a very useful function.