Sometimes we need to get the status of the keys in the keyboard. For example we need to check whether the Caps Lock key is on or not programmatically.
This could be established by using the Windows API function GetKeyState. Actually this function retrieves the status of the spcified virtual key. There have a virtual-key codes corresponding to each keys in the keyboard.
void CheckKeyState() { if ((GetKeyState(VK_CAPITAL) & 0x0001)!=0) AfxMessageBox("Caps Lock ON!"); else AfxMessageBox("Caps Lock OFF!"); }
We could also use the function GetAsyncKeyState for this purpose.
Thank you very much!
TY
is it possible to do this in javascript?
Please check the link http://stackoverflow.com/questions/348792/how-do-you-tell-if-caps-lock-is-on-using-javascript