English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

I have tried using this API:
Private Declare Function GetAsyncKeyState Lib "user32" (ByVal vKey As Long) As Integer

...it is working fine but not as desired. This uses a timer(usually w/ interval=1) to check what is currently key pressed. This solution causes computer hog, specially w/ outphased computers. Is there any other way that records the key instantly the user presses a key.


By the way, this appeared in our hands-on exam, and I'm not satisfied with my above solution.

2007-03-24 04:05:19 · 2 answers · asked by vitualpalab0i 1 in Computers & Internet Programming & Design

2 answers

Only the window (and its process) that has focus receives keyboard events. GetAsyncKeyState may be used, but can be too slow on VB.
You may try with SetWindowsHookEx to hook all keyboard messages, but this is also a performance degradation when done in VB.

2007-03-26 21:00:33 · answer #1 · answered by BataV 3 · 0 0

idk whats the diff between keydown and keypress...? inner maximum declare Sub keybd_event Lib "user32" Alias "keybd_event" (ByVal bVk As Byte, ByVal bScan As Byte, ByVal dwFlags As long, ByVal dwExtraInfo As long) inner maximum sub press_enter() keybd_event &HD, 0, 0, 0 keybd_event &HD, 0, 2, 0 end sub

2016-10-19 12:28:15 · answer #2 · answered by ? 4 · 0 0

fedest.com, questions and answers