keystate .net component


Certain keys on the keyboard are toggle keys - they are either on or off, the status often indicated by an LED. It is sometimes necessary to determine the status of these keys, for example, when indicating to the user of a program that CapsLock is on. The Windows API contains a function to do this, but the .NET framework does not, and there is no component included in Visual Studio .NET to do this either (unlike previous versions).

The KeyState component is a simple .NET component which wraps the API call in a managed class, and which raises an event if the status of the selected key changes.

component code

The source code is not included in the download, but one of the tutorials on this site explains how it is written. This version is a cleaned-up release version with a small bug fix.

system requirements

To use KeyState you will need:


KeyState is supplied as a zipped archive, so you will need an unzipping utility such as Winzip to expand it after downloading. The archive contains the .DLL file which implements the component, an HTML Help file, and possibly a short text file with any additional information not included in the help file. Full instructions for installation and use are contained in the help file.

Download Download the KeyState component (25K)