Results 1 to 2 of 2

Thread: GetAsyncKeyState() Problem...

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Feb 2000
    Location
    Israel
    Posts
    636

    Exclamation GetAsyncKeyState() Problem...

    Hi, Guys!

    How can I set false all the GetAsyncKeyState() keys?
    Sometimes I get some True values...
    I want something like reseting all keys...

    Thank you,
    Arie. (mag.up.co.il)

  2. #2
    Guru Aaron Young's Avatar
    Join Date
    Jun 1999
    Location
    Red Wing, MN, USA
    Posts
    2,177
    You can't reset the "GetAsyncKeystate()" value, (although I suppose you could use the "SetKeyboardState()" API, but it's unnecessary.)

    If you're just concerned with the inital spurt of key state triggers you can get starting an application, then just do something like this when your application starts:
    VB Code:
    1. Private Declare Function GetAsyncKeyState Lib "user32" (ByVal vKey As Long) As Integer
    2.  
    3. Private Sub Form_Load()
    4.     Dim lKey As Long
    5.     Do While lKey < 256
    6.         For lKey = 0 To 255
    7.             If GetAsyncKeyState(lKey) Then Exit For
    8.         Next
    9.         DoEvents
    10.     Loop
    11. End Sub

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