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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

GetAsyncKeyState question

Status
Not open for further replies.

mi1306

Technical User
Jul 14, 2004
44
BG
I would use GetAsyncKeyState what to catch what key was pressed on keyboard.
Mine code:

Function GetKey $ ()
For Cnt=1 To 255
If (GetAsyncKeyState (Cnt) And *H8001) < > 0 Then
GetKey $ = Chr (Cnt)
Exit For
End If
Next Cnt
End Function


Code works but returns only main letters.
How I can correct it?


Mi1306
 
Why not use OnKeyPress and use the Keyascii value?


"Own only what you can carry with you; know language, know countries, know people. Let your memory be your travel bag.
 
It is possible that OnKeyPress may not be appropriate. For example, it won't capture key strokes directed at a different application. I think we need to understand mi1306's requirement a little better first
 
strongm,
It will capture key strokes directed at a different application,
But only main (KeyAscii from 1 up to 90).
If to set KeyAscii > 90 nothing capture key

mi1306
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top