Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to detect if caps lock is already active? [duplicate]

Tags:

c++

c#

windows

Supposing I want to detect if the caps lock is active so if the keys are upper case, what can I use in c++ with windows?

I would need an equivalent of Console.CapsLock in C#

I already tried using GetAsyncKeyState(VK_CAPITAL) but I don't need the key state I need to know the "toggle" status

like image 645
Sam Avatar asked Nov 08 '25 00:11

Sam


1 Answers

The return value from GetKeyState (Win32) has a low order bit (least significant bit) which gives its current toggle status.

If the bit is 1, then the key is toggled. But if it is 0, then the key is not toggled.

like image 63
Robinson Avatar answered Nov 10 '25 16:11

Robinson



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!