Good afternoon all!

As is most often the case in this forum, I am faced with a problem I cannot seem to solve.

I am trying to write a program that reads the state of the caps-lock key. If it is active I want it to display a picture on my screen (in front of all my other programs) and if it is not.. You can probably guess.

My skills with C# are still limited, but I'm trying to learn as much as I can by trying to write things I will actually use and research the required code I use.

My question specifically is this:
I am writing this as a windows form application (though maybe as a windows service it would be better but I have zero experience in this), but I want the program to be in the background, but still look for the state of the caps-lock key. How can I do this? (hints/pointers/actual code?)

Also, I've figured that the way to display the picture would be to set the formbackgroundimage to the picture I want, and then using .hide and .show to make clear that caps lock has been triggered... However (nothing is ever easy right?), I __don't__ want it to steal focus from whatever it is I'm typing in.


Any clues/hints/pointers/information/code/help/anything about any of this would be immensely appreciated!

Check out this thread. It's got how to turn it off and on too (beyond what you need I know) but the detection of it is simple. I don't know anything about writing services but if you were to make a regular form and run it on a timer (so check the status every N milliseconds) it would probably do the job. I'm not sure about the focus aspect either. It sounds like a neat little widget.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.