문제

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.

I'm trying to do that in both C++ and Delphi.
Please help

도움이 되었습니까?

해결책 2

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

다른 팁

I found this link and the code snippet below that might help you

if ((GetKeyState(VK_CAPITAL) & 0x0001)!=0)
  AfxMessageBox("Caps Lock ON!");
else
  AfxMessageBox("Caps Lock OFF!");

Use GetAsyncKeyState with VK_CAPITAL (0x14)

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top