Keyboard Listener

  • Thread starter Thread starter YSChong
  • Start date Start date
Y

YSChong

Hi all,

I'm just a newbie doing undergrad in Computing. I always face problems
when it comes to looking for an appropriate method. Lately, I've been
trying to write an application that listens to every single keystroke
from the keyboard. I don't seem to be able to find the proper way to
do that. Thanks in advance!!
 
in the form props turn keypreview on
in the code use the keydown (sometimes key up or keypres could be better)
example
\\
Private Sub frm_KeyDown(ByVal sender As Object, ByVal e As
System.Windows.Forms.KeyEventArgs) Handles MyBase.KeyDown
Try
If e.KeyCode = Keys.Enter Or e.KeyCode = Keys.Return Then
'txt()
Select Case True
Case txtZoek.Focused
vulData()
Case Else
SendKeys.Send("{Tab}")
End Select
End If

If e.KeyCode = Keys.Down Then
GridDown()
End If

If e.KeyCode = Keys.Up Then
GridUp()
End If

Catch ex As Exception
fmMain.boodschap("formkeydown: " & ex.Message, 6)

End Try
End Sub
//
 
* (e-mail address removed) (YSChong) scripsit:
I'm just a newbie doing undergrad in Computing. I always face problems
when it comes to looking for an appropriate method. Lately, I've been
trying to write an application that listens to every single keystroke
from the keyboard. I don't seem to be able to find the proper way to
do that.

<URL:http://www.developer.com/net/net/article.php/11087_2193301_1/>

Win32 documentation on hooks:

<URL:http://msdn.microsoft.com/library/e...sUserInterface/Windowing/Hooks/AboutHooks.asp>
 
Back
Top