Results 1 to 5 of 5

Thread: Detecting keyboard

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Jan 2006
    Posts
    135

    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.

  2. #2
    Frenzied Member
    Join Date
    Oct 2005
    Posts
    1,286

    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.
    Pete Vickers
    MVP - Device Application Development
    http://www.gui-innovations.com http://mobileworld.appamundi.com/blogs/

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Jan 2006
    Posts
    135

    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.

  4. #4
    Frenzied Member
    Join Date
    Oct 2005
    Posts
    1,286

    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
    Pete Vickers
    MVP - Device Application Development
    http://www.gui-innovations.com http://mobileworld.appamundi.com/blogs/

  5. #5
    New Member
    Join Date
    Oct 2004
    Location
    The Netherlands
    Posts
    15

    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
  •  



Click Here to Expand Forum to Full Width