WinAPI: How to get the caps lock state?

前端 未结 3 1920
-上瘾入骨i
-上瘾入骨i 2020-12-06 02:12

How can get whether Caps Lock is on or off? I tried to search it but all I\'m finding is how to toggle or turn it on/off which is exactly opposite of what I\'m looking for.<

3条回答
  •  北荒
    北荒 (楼主)
    2020-12-06 02:51

    You want the GetKeyState() function:

    http://msdn.microsoft.com/en-us/library/ms646301(VS.85).aspx

    with the VK_CAPITAL key code. Rest of the virtual key codes are here:

    http://technet.microsoft.com/en-us/subscriptions/index/dd375731(v=vs.85).aspx

提交回复
热议问题