samedi 18 avril 2015

How to check if the caps lock in on/off using C++?

I need to check if the the Caps-Lock in on or off.


I have tried this function



bool CheckKeyState()
{
if ((GetKeyState(VK_CAPITAL) & 0x0001)!=0)
return true;

return false;

}


I had to include the windows library



#include <Windows.h>


But it is returning true weather the caps is on or off.


what am I doing wrong? how can I check if the Caps-Lock in on or not?


Aucun commentaire:

Enregistrer un commentaire