VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



This program gets the state of any key on the keyboard. It works even when many other keys are bein

by Nichols Software (5 Submissions)
Category: Windows API Call/Explanation
Compatability: Visual Basic 5.0
Difficulty: Unknown Difficulty
Originally Published: Wed 6th September 2000
Date Added: Mon 8th February 2021
Rating: (1 Votes)

This program gets the state of any key on the keyboard. It works even when many other keys are being pressed! It also works when your program

Rate This program gets the state of any key on the keyboard. It works even when many other keys are bein



'get key input when more than four keys are being
'pressed? With this API it is no longer a problem!
'This is a short sample that gets the state of any key
'on the keyboard. The numbers passed in are the same as
'the keycodes in Form_KeyDown. You can look these up by
'typing "key code constants" in the VB help. The return
'values are sort of weird. At the beginning, the value
'of an unpressed key is 0, if it is held down after that,
'the value is -127, unpressed again is 1, and the second
'pressed value is -128. This cycle then repeats itself.

Dim RetValue As Long
Dim SendKeyCode As Long
SendKeyCode = 37 'Left key
RetValue = GetKeyState(SendKeyCode)
Print RetValue


Download this snippet    Add to My Saved Code

This program gets the state of any key on the keyboard. It works even when many other keys are bein Comments

No comments have been posted about This program gets the state of any key on the keyboard. It works even when many other keys are bein. Why not be the first to post a comment about This program gets the state of any key on the keyboard. It works even when many other keys are bein.

Post your comment

Subject:
Message:
0/1000 characters