Results 1 to 6 of 6

Thread: GetKeyState

  1. #1

    Thread Starter
    Not NoteMe SLH's Avatar
    Join Date
    Mar 2002
    Location
    192.168.0.1 Preferred Animal: Penguin Reason for errors: Line#38
    Posts
    3,051

    GetKeyState

    Hi all, firstly i know that i can use the getkeystate command to detect whether a key is pressed i.e. if getkeystate(vbkeyup) < 0 then...

    What i wondered is, does the value returned mean anything usefull? Values i keep getting are 0,1,-128,-127 and i can't see any connection with the state of the key it checks, apart from if it's negative the user is pressing it.

    Thanks for any posts.
    Quotes:
    "I am getting better then you guys.." NoteMe, on his leet english skills.
    "And I am going to meat her again later on tonight." NoteMe
    "I think you should change your name to QuoteMe" Shaggy Hiker, regarding NoteMe
    "my sweet lord jesus. I've decided never to have breast implants" Tom Gibbons
    Have I helped you? Please Rate my posts.


  2. #2
    Hyperactive Member
    Join Date
    Nov 2001
    Location
    Catalonia
    Posts
    397
    The return value specifies the status of the given virtual key, as follows:

    If the high-order bit is 1, the key is down; otherwise, it is up.

    If the low-order bit is 1, the key is toggled. A key, such as the caps lock key, is toggled if it is turned on. The key is off and untoggled if the low-order bit is 0. A toggle key's indicator light (if any) on the keyboard will be on when the key is toggled, and off when the key is untoggled.


    I copied the answer from MSDN

    High-order bit=1 means negative
    High-order bit=0 means positive
    Josep Mª

  3. #3
    Lively Member
    Join Date
    Apr 2001
    Location
    Central NC
    Posts
    75
    Be warned - the key toggled bit is disabled under ME.

  4. #4
    Addicted Member
    Join Date
    Apr 2002
    Posts
    235
    does this include win 98 too? Is there another way to check for the capslock?

  5. #5
    Lively Member
    Join Date
    Apr 2001
    Location
    Central NC
    Posts
    75
    Nah, the key toggled bit is disabled just in ME. That aside, that's the way to do it in 98.

  6. #6
    New Member
    Join Date
    Aug 2009
    Posts
    1

    Cool Re: GetKeyState

    This is what I get for GetKeyState, try this:
    1 = ON
    0 = OFF
    -127 = 1 (ON)
    -128 = 0 (OFF)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width