Jump to content

keyboard

- - - - -

This topic has been archived. This means that you cannot reply to this topic.
2 replies to this topic

#1
bodhi2016

bodhi2016

    Newbie

  • Members
  • PipPip
  • 29 posts
Well i am reading the keyboard portion of the book.I want to make a programme with which i can switch the caps lock on and off.
iState = GetKeyState (VK_CAPITAL) ;

has the low bit set if the Caps Lock key is toggled on
Can somebody explain me the meaning of low bit set.Does it mean that the extreme left hand side is bit 0.
Is there any way i can force the VK_capital to change the value so that it has a high bit set then i can switch off the caps lock from the programme.
Often i have seen this numbers like 0X00081 or 0x00001 .CAn anybody please tell the meaning of this or any articke in the net about this,
Thank You

#2
MeTh0Dz

MeTh0Dz

    Writes binary right handed and hex left handed

  • Members
  • PipPipPipPipPipPipPipPipPip
  • 2,119 posts
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.

#3
bodhi2016

bodhi2016

    Newbie

  • Members
  • PipPip
  • 29 posts
In short my brother who works in Intel challenged me to make a programme with
which can i switch the caps lock on and off ,without touching the caps lock key directly