Try using GetAsyncKeyState api.