Archived

This topic is now archived and is closed to further replies.

Authustian

the *Lock keys (quick question)

Recommended Posts

Authustian    125
This may sound a little silly, but i''d like to be able to see the value of 3 bool variables by useing the "Caps Lock", "Scroll Lock", and "Num Lock" lights on my keyboard. Now i know there has to be a realy easy way to toggle/set the value of those things, but i just can''t seem to figure out how. Thanx in advance for the help. ------------------------------------------------- Don''t take life too seriously, you''''ll never get out of it alive. -Bugs Bunny

Share this post


Link to post
Share on other sites
EddieCai    122
To toggle the NUM LOCK, CAPS LOCK, or SCROLL LOCK keys, you can use the following logic:
Use the GetKeyboardState function to determine the state of the key.
Determine which operating system is being used with the GetVersionEx API. (Windows 95/98 and Windows NT/2000 require different methods for toggling these keys.)
Under Windows 95 or Windows 98, use the SetKeyboardState API function to set the state of the key. Under Windows NT or Windows 2000, use the keybd_event function to simulate a key press.
Pls refer to MSDN for details.

Share this post


Link to post
Share on other sites