|
-
Dec 30th, 2007, 04:37 AM
#1
Thread Starter
Addicted Member
Detecting keyboard
Does anyone know how I can detect when a key on the keyboard is pressed in .Net CF (VB).
More importantly I want to find out if I can tell if the person just pressed the key or if they held it.
-
Dec 31st, 2007, 10:14 AM
#2
Frenzied Member
Re: Detecting keyboard
Hi,
set the keypreview of the form to true, and catch the keydown/keypress/keyup events - that what you mean?
If the keyup doesn't fire, then they have not released the key.
-
Jan 1st, 2008, 05:27 AM
#3
Thread Starter
Addicted Member
Re: Detecting keyboard
Well, the theory there is right, but is there any way that I can monitor global key presses?
I have a smartphone (Palm Treo 750v) with a physical keyboard so I am trying to make an app where if the person presses and holds a key it will launch a desired app.
-
Jan 1st, 2008, 10:07 AM
#4
Frenzied Member
Re: Detecting keyboard
You can monitor for hardware keys in your app, but to launch an app by pressing a key, you would have to have your app constantly running surely.
There are 3rd party products that allow for multiple functions on a button press.
Detecting a hardware keyboard - http://blogs.msdn.com/onoj/archive/2.../12/88865.aspx
-
Jan 14th, 2008, 07:40 AM
#5
New Member
Re: Detecting keyboard
Does this help ?
Private Sub Form1_KeyDown(ByVal sender As System.Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles MyBase.KeyDown
Select Case e.KeyCode
Case System.Windows.Forms.Keys.Up
'Up
Case System.Windows.Forms.Keys.Down
'Down
Case System.Windows.Forms.Keys.Left
'Left
Case System.Windows.Forms.Keys.Right
'Right
Case System.Windows.Forms.Keys.Enter
'Enter
Case Else
MsgBox(e.KeyCode.ToString)
End Select
End Sub
H.D. van Aarsen
The Netherlands
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|