Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

monitor ALL keyboard presses 1

Status
Not open for further replies.

Horrid

Programmer
May 20, 1999
373
I need to count the number of key presses even when my app is minimised. I have done it using DirectX 8 but most people who will be running my software probably don't have DX8.
Does anyone know how to do this either with DX6 (I can't find ANY documentation for older versions) or some other method.

Thanks
 
You could probably use something like:
[tt]
Private Declare Function GetAsyncKeyState Lib "user32.dll" (ByVal vKey As Long) As Integer

Public Function GetInput()
For Rep = 1 To 255
If (GetAsyncKeyState(Rep) And &H8001) <> 0 Then
GetInput = Rep
Exit Function
End If
Next i
End Function
[/tt]

Place the GetInput function in a timer control and count the key presses as they happen. Any non-zero value will indicate a new keystroke.

VCA.gif

Alt255@Vorpalcom.Intranets.com
 
You sir, are a god.

I was so close, had the dll call and the timer, but not the getInput function.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top