
-----------------------------------
CodeMonkey2000
Mon Oct 29, 2007 5:06 pm

How do I poll events? Or at least take multiple keydown evets at once?
-----------------------------------
My problem is that vb only recognizes that only one key is being pressed at a time. How do I allow for multiple key presses?

-----------------------------------
Tony
Mon Oct 29, 2007 5:55 pm

RE:How do I poll events? Or at least take multiple keydown evets at once?
-----------------------------------
You could possibly build up a queue for the key strokes, and read input from there.

-----------------------------------
CodeMonkey2000
Tue Oct 30, 2007 3:13 pm

RE:How do I poll events? Or at least take multiple keydown evets at once?
-----------------------------------
And how do I do that?

-----------------------------------
cool dude
Thu Nov 01, 2007 9:43 am

Re: How do I poll events? Or at least take multiple keydown evets at once?
-----------------------------------
I programmed this a long time ago. here is a little example where u can press multiple keys.

-----------------------------------
Brightguy
Thu Nov 01, 2007 2:46 pm

Re: How do I poll events? Or at least take multiple keydown evets at once?
-----------------------------------
Er, Private keys(256) As Byte

Private Declare Function GetKeyboardState Lib "user32.dll" (pbKeyState As Byte) As Long

Private Sub Timer1_Timer()
    GetKeyboardState keys(0)

    If keys(vbKeyUp) And &H80 Then guy1.Top = guy1.Top - 60
    If keys(vbKeyDown) And &H80 Then guy1.Top = guy1.Top + 60
    If keys(vbKeyRight) And &H80 Then guy1.Left = guy1.Left + 60
    If keys(vbKeyLeft) And &H80 Then guy1.Left = guy1.Left - 60
End Sub

-----------------------------------
MIdas0036
Thu Dec 20, 2007 9:53 am

Re: How do I poll events? Or at least take multiple keydown evets at once?
-----------------------------------
this is something i program this aloang time ago to lock my computer while i am out of class and it has the same keypress function that you are asking about but easy to code

-----------------------------------
CodeMonkey2000
Thu Dec 27, 2007 2:53 pm

RE:How do I poll events? Or at least take multiple keydown evets at once?
-----------------------------------
What does &H80 mean?

-----------------------------------
OneOffDriveByPoster
Thu Dec 27, 2007 9:55 pm

Re: RE:How do I poll events? Or at least take multiple keydown evets at once?
-----------------------------------
What does &H80 mean?It's VB notation for hexadecimal.  &H80 is 0x80 is (in binary:  )1000 0000.

-----------------------------------
CodeMonkey2000
Thu Dec 27, 2007 11:41 pm

RE:How do I poll events? Or at least take multiple keydown evets at once?
-----------------------------------
In the if statement in the code above what is the &H80 checking?

-----------------------------------
OneOffDriveByPoster
Fri Dec 28, 2007 9:47 am

Re: RE:How do I poll events? Or at least take multiple keydown evets at once?
-----------------------------------
In the if statement in the code above what is the &H80 checking?Well as previously posted, 0x80 is 1000 0000.  So using the bitwise-and with 0x80 (on a byte) checks if the high-order bit is set (i.e. 1).  GetKeyboardState() changes the array to reflect the status of keys.  "If the high-order bit is 1, the key is down; otherwise, it is up." (from MSDN)
