Avatar of jazjef
jazjef

asked on 

Why do my SmartPhone 'keyboard' keys respond to my VB.Net code but the navigation wheel R , L, Up, Down don't???

Using:  Motorola Q SmartPhone with Windows Mobile 5; SmartPhone SDK 5 project Visual Studio 2005

Here's a piece of code from MSDN that works:

    Private Sub keypressed(ByVal o As [Object], _
        ByVal e As KeyPressEventArgs) Handles MyBase.KeyPress
        ' Determine if ESC key value is raised.
        If e.KeyChar = ChrW(Keys.Escape) Then
            ' Handle the event to provide your own functionality.
            e.Handled = True

            ' Add  your event handling code here.
            MsgBox("Custom back key functionality.")

        End If
    End Sub


If I change this code from 'Keys.Escape' to 'Keys.Up' when I press the navigation wheel UP arrow, I get nothing. If I change it to Left or RIght or Down I still get nothing. Don't the UP, DOWN, LEFT, RIGHT arrow keys of the keyboard map to these navigation buttons on a SmartPhone in some way?

Why doesn't this code detect these navigation buttons.... it will detect the keyboard events...Help please. Thanks....



Smartphone Programming.NET Programming

Avatar of undefined
Last Comment
darksb
Avatar of alexey_gusev
alexey_gusev
Flag of United Kingdom of Great Britain and Northern Ireland image

Up/Down/etc keys don't generate KeyPress events, but you can use KeyDown or KeyUp instead
Avatar of jazjef
jazjef

ASKER

It doesn't matter.... the hardware buttons cannot be detected in KeyPress, KeyDown, or KeyUp ....
Avatar of Mikal613
Mikal613
Flag of United States of America image

is your keypress on the Form Level on an object level (TExtbox)?
Avatar of jazjef
jazjef

ASKER

Hi Mikal613...

My successful code is on the form level.....

I actually figured out how to get them to work in the KeyDown sub.... so I was totally wrong about that. So, this solves my problem except for the fact that I don't want application focus hardware key data.... I want global hardware response data that my application records no matter what application is open on the device.

Yeah I know, I writing a program that records user activity secretly----but it is not illegal when it's for mobile device usability testing and you have the 'informed consent' of experiment participants to record their actions on a device.

A lot of people in the world don't know how valuable recording user actions can be. They only see 'stealth' programs as being a tool of evil. Just like the people who think that all guns are designed for shooting other people.....

The only reason I am making the program hidden is to avoid users exploring the device and accidentally closing down the program thus costing time and data loss.

So, I need to start my program, then hide it, then give it to the user with the pre-specified task, and then close out the program when they have completed the task.

OK... so now I can record the R,L,UP,DOWN, ACTION and all other keys.... But how do I make it keep going when the application loses focus?

Actually Mikal613, my question has been answered..... I should just give you the points and open a new question about how to keep the application 'awake' when it's not in focus....


Avatar of Mikal613
Mikal613
Flag of United States of America image


      
Private Sub Form1_LostFocus(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.LostFocus
Form1.SetFocus()
End Sub
Avatar of jazjef
jazjef

ASKER

I get the following error with your code:

'SetFocus'  is not a member of 'My_WinMob5_Project'


This is a Windows Mobile 5.0 Smartphone project.... so it has issues with direct vb.net coding translation...
Avatar of Mikal613
Mikal613
Flag of United States of America image

shoot my bad i forgot
ASKER CERTIFIED SOLUTION
Avatar of jazjef
jazjef

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
Avatar of darksb
darksb

is not setfocus  but me.Focus()

but that not work, form lose focus again, i use a timer with

OpenNETCF.Win32.Win32Window.SetFocus(OpenNETCF.Win32.Win32Window.GetActiveWindow)

to reset focus on the form

.NET Programming
.NET Programming

The .NET Framework is not specific to any one programming language; rather, it includes a library of functions that allows developers to rapidly build applications. Several supported languages include C#, VB.NET, C++ or ASP.NET.

137K
Questions
--
Followers
--
Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews

TRUSTED BY

IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo