Is there a direct way to detect if CapsLock is on or not.

Is there a way to detect if Caps Lock is on or not directly.
Other then when the keyboard down or up is detected ?

.
.
A example scenario.

I start off the application with caps lock down.
I press the caps lock key.
When using the keyboard class i detect it is down and believe it is pressed when it is actually being turned off .

Im testing a text input and keyboard event wrapper that dis-allows garbage collections while allowing Enable Disabling of registered methods. This replaces garbage generated from registering and un-registering to text input. It also allows more control of information given back from one class. As well as not needing to use both text input and keyboard.
This works satisfactorily so far and im pleased with it. However this is a particular problem which i have encountered doing this since im only using keyboard underneath.

https://stackoverflow.com/questions/577411/how-can-i-find-the-state-of-numlock-capslock-and-scrolllock-in-net will this do?

1 Like

Ah duh i didn’t even know it was in there man i feel dumb.

var cap = Keyboard.GetState().CapsLock;

1 Like