Results 1 to 7 of 7

Thread: keyboard Problem

  1. #1

    Thread Starter
    New Member
    Join Date
    Jul 2000
    Posts
    9

    Question

    How Can i clean the bufer form the keyboard ?
    I need to get only one key one i press on the keyboard .
    for example: when i press 'W' and not releas the key I get
    WWWWWWWWWWWWWWWW and I need ONLY one W ??????


  2. #2
    Frenzied Member sebs's Avatar
    Join Date
    Sep 2000
    Location
    Aylmer,Qc
    Posts
    1,606
    do you mean in vb or....
    if textbox , put it's max lengtht to 1

  3. #3
    Fanatic Member
    Join Date
    Feb 2000
    Location
    The Netherlands
    Posts
    715
    Are you using the GetAsyncKeyState api function to get the keyboard presses?
    Oetje
    [email protected]
    93606776
    Visual Basic 6, Windows 2000

    Never pet a burning dog

  4. #4

    Thread Starter
    New Member
    Join Date
    Jul 2000
    Posts
    9
    No I use GetKeyState in VB6.
    bat i need to clean the bufer.

  5. #5
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    Store the state and xor it against the new state and you recieve the event.
    Code:
    tempState=getasynckeystate(key)
    if oldstate xor tempstate then event=cbool(tempstate)*2+1 else event=0
    oldstate=tempstate
    Use
    writing software in C++ is like driving rivets into steel beam with a toothpick.
    writing haskell makes your life easier:
    reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
    To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.

  6. #6

    Thread Starter
    New Member
    Join Date
    Jul 2000
    Posts
    9

    Unhappy

    No !!!
    The buffer still not clean ....

  7. #7
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    one access will clean it. Thats why you have to check the state all the time.
    Use
    writing software in C++ is like driving rivets into steel beam with a toothpick.
    writing haskell makes your life easier:
    reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
    To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.

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