Toggle Keys Controller
Overview A couple of days before I wrote this article, a member asked how to control the Caps, Num and Scroll lock keys. I knew there were several implementations around so I searched with a view to providing the poster with a link, but I couldn't find one that was complete. Many just read the state of these keys, some also allowed you to set them, but I couldn't find any that monitored them so your application was updated accordingly. So, this article is the result. The ToggleKeysController class in the code attached will monitor these keys and raise events when a change is detected, and allow you to get or set the state. Unanticipated Problems This isn't quite as simple as I first thought it would be! The first thing to do was to get the state of the keys. I knew the Console class had a CapsLock property so I figured it would probably be the answer. Unfortunately, it doesn't have a ScrollLock property. The next step was to set the key states. The one...