Click here to Skip to main content
65,938 articles
CodeProject is changing. Read more.
Articles
(untagged)

Windows Mobile – The no-go World of Function Keys

0.00/5 (No votes)
21 Dec 2011 2  
Summary of the role of function keys in Windows Mobile

I want to summarize the role of function keys in Windows Mobile, former Pocket PC, as I got several questions each week on how to use or enable function keys in applications.

Here is some simple information about how function keys work in Windows Mobile.

As an example, you have a web application which shows F3 and F4 as shortcuts to the previous/next page:

SAP ITS Mobile screen Intermec Browser

SAP ITS Mobile screen Intermec Browser

Without some preparation, this screen will not react to function keys! As the screen shows Intermec Browser (IB) with a SAP ITS Mobile form, you are able to define the settings in IB to be able to really use the Function Keys.

Windows Mobile uses function key values for its own purpose. The usage can be retrieved by looking at winuserm.h of a Windows Mobile SDK:

//winuserm.h
...
#define VK_TSOFT1 VK_F1 	// Softkey 1
#define VK_TSOFT2 VK_F2 	// Softkey 2
#define VK_TTALK VK_F3 		// Talk
#define VK_TEND VK_F4 		// End
...
#define VK_TRECORD VK_F10 	// Record
#define VK_TFLIP VK_F17 	// Flip
#define VK_TPOWER VK_F18 	// Power
#define VK_TVOLUMEUP VK_F6 	// Volume Up
#define VK_TVOLUMEDOWN VK_F7 // Volume Down
...
#define VK_TSPEAKERPHONE_TOGGLE VK_F16
#define VK_END_ALL_DATA_CALLS VK_F15
...
#define VK_TSTAR VK_F8 		// *
#define VK_TPOUND VK_F9 	// #
...
#define VK_SYMBOL VK_F11 	// Symbol (SYM) key

#define VK_REDKEY VK_F19 	// Sent by a keypad that has a special red function key
#define VK_ROCKER VK_F20 	// Arrow keys came from a Rocker
#define VK_DPAD VK_F21 		// Arrow keys came from a DPAD
#define VK_ACTION VK_F23 	// Sent with VK_RETURN when doing Action on PPC rockers

#define VK_VOICEDIAL VK_F24 // Key used to kick off voice dial recognition
#define VK_KEYLOCK VK_F22 	// Key used to lock the device
#define VK_KEYUNLOCK VK_F25 // Key used to unlock the key lock

// Chorded keys. DONE is VK_RWIN + VK_F6 and MOJI is VK_RWIN + VK_F7
#define VK_DONE VK_F6 		// <OK/Close> hotkey code
#define MOD_DONE (MOD_WIN | MOD_KEYUP) // <OK/Close> hotkey modifiers

#define VK_MOJI VK_F7 		// Key used to switch between FE language layouts
#define MOD_MOJI (MOD_WIN | MOD_KEYUP) //Modifiers so MOJI goes to the shell
...

You see that many function key values are assigned to OS specific functions like Phone, END, Volume Up/Down etc.

So, you can normally not use Function Keys in your application to provide shortcuts to function calls. This is also true for client applications like Terminal Emulators (TE) like NaurTechTE and Intermec TE (ITE), browser based applications like Internet Explorer Mobile or Intermec Kiosk Mode Browser (IB), thin clients like Java client apps (i.e., SAP ITS Mobile) or Remote Desktop client apps (i.e., Remote Desktop Mobile, zaDesktop).

Some of the kiosk mode apps provide a way to enable you to use Function Keys (see example at top). They can do so, as they use API calls like UnregisterFunc1 or AllKeys(TRUE) or GXOpenInput (deprecated!). These APIs instruct Windows Mobile OS to not catch and use Function Keys but handle them like ‘normal’ keys.

If you are the coder of an application using C++, C#, VB.NET, or Java, you can use the Microsoft API function AllKeys(TRUE) in your code and Windows Mobile will not tamper the function keys.

If you are not the coder, you may use UnregisterFunc1 (see my post Freedom for Function Keys). But be warned, there are applications that even then will not process Function Keys or do not forward them. For example, Internet Explorer Mobile (IEM) will not process Function Keys except for internal functions like help or full-screen. Another bad example is Remote Desktop Mobile (RDM). It does not support Function Keys, even if you un-register them before you launch RDM, Function Keys will not be processed or transmitted to the host application. An alternative to RDM with function key support is rdesktopCE.

When you use UnregisterFunc1, you can check the Function Keys using a tool like KeyTest3AK. It will show the keydown and keyup values of keys and show what happens if you use AllKeys():

More posts about AllKeys

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here