Thread: keyboard
View Single Post
  #2 (permalink)  
Old 06-03-2008, 11:11 AM
MeTh0Dz MeTh0Dz is offline
SLICE OWNZ YOUR SOUL
 
Join Date: May 2008
Posts: 294
Last Blog:
Ternary Operator CPP
Rep Power: 0
MeTh0Dz has a spectacular aura aboutMeTh0Dz has a spectacular aura aboutMeTh0Dz has a spectacular aura about
Default Re: keyboard

Your post is confusing. First you say you want to switch the state of the cap locks key, then you start asking questions about GetKeyState(). Which is a function that gets that status of a key.

To answer your question about the low bit / high bit. The high bit is -> (0x10000000) and the low bit is -> (0x00000001). Basically you are going to want to 'And' (&) your return values with one of those values depending on what you are trying to do. That is how you check the status of a key, however using GetAsyncKeyState() might be a better choice, search on MSDN for more information.

Now, to actual change the key state, you need to use some different functions. You will need to use SetKeyboardState(), SendInput(), or keybd_event(). These functions can be used to toggle the status of the cap locks key, hence turning it on or off. Use msdn to learn the syntax of these commands.

Hopefully that helps out.
Reply With Quote