Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

KEYBOARD????

bodhi2016bodhi2016 Member Posts: 50
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

Comments

  • zibadianzibadian Member Posts: 6,349
    : 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
    :
    The low bit is the right hand most bit of an integer. If a bit is 1 then it is set. A bit is the digit of a binary number, thus the number 01001001 has the low bit set. This is the same with integer numbers in every day life, the lowest digit is the right hand most digit.
    In many programming languages the prefix 0x before a number means that that number is in the hexadecimal notation. Thus 0x00081 is 81 in hexadecimal, or 8*16+1 = 129.
    See http://en.wikipedia.org/wiki/Hexidecimal for a more detailed explanation.
  • AsmGuru62AsmGuru62 Member Posts: 6,519
    [color=Blue]
    Visit GOOGLE and type: msdn getkeystate --- in its search box. The very first link is the one you need - all explained about the function:

    [link=http://msdn.microsoft.com/en-us/library/ms646301(VS.85).aspx]http://msdn.microsoft.com/en-us/library/ms646301(VS.85).aspx[/link]

    This GOOGLE trick :-) works also for other API functions.[/color]
  • bodhi2016bodhi2016 Member Posts: 50
    But is there any way i can change the value of VK_CAPITAL so that it will have a high bit set so that i can switch the caps lock off from the programme itself.

  • zibadianzibadian Member Posts: 6,349
    : But is there any way i can change the value of VK_CAPITAL so that it
    : will have a high bit set so that i can switch the caps lock off from
    : the programme itself.
    :
    :
    No, because that value is defined by the windows API. Besides why would you want to do that? It is just as simple to set the high bit as it is to set the low bit:
    [code]
    flags = flags | 0x0001; // set low bit
    [/code]
    [code]
    flags = flags | 0xF000; // set high bit
    [/code]
    [code]
    flags = flags | VK_CAPITAL; // set caps-lock bit
    [/code]
  • LundinLundin Member Posts: 3,711
    : It is just as simple to set the high bit
    : as it is to set the low bit:
    : [code]:
    : flags = flags | 0x0001; // set low bit
    : [/code]:
    : [code]:
    : flags = flags | 0xF000; // set high bit
    : [/code]

    Hrm. Should be 0x8000. ;-)

  • bodhi2016bodhi2016 Member Posts: 50

    : No, because that value is defined by the windows API. Besides why
    : would you want to do that? It is just as simple to set the high bit
    : as it is to set the low bit:
    : [code]:
    : flags = flags | 0x0001; // set low bit
    : [/code]:
    : [code]:
    : flags = flags | 0xF000; // set high bit
    : [/code]:
    : [code]:
    : flags = flags | VK_CAPITAL; // set caps-lock bit
    : [/code]:
    :
    What i meant is that i want to make a programme with which i can switch off the caps lock on and off.
    I dont want to change value of VK_CAPITAL rather i want to change the value of iState or set the value of bit set according to my wish.
Sign In or Register to comment.