Windows Mobile – the no-go world of Function Keys

Print This Post Print This Post

Hello

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 this or that application.

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

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

SAP ITS Mobile screen Intermec Browser

SAP ITS Mobile screen Intermec Browser

Without some prepare this screen will not react on function keys! As the screen shows Intermec Browser (IB) with a SAP ITS Mobile form, you are able to define 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:

[codesyntax lang=”cpp” lines=”normal” lines_start=”1″]

//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
...

[/codesyntax]

You see that many FunctionKey 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 (ie. SAP ITS Mobile) or Remote Desktop client apps (ie 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 CPP, CSharp (C#), VB.NET, CPP 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 shows what happens if you use AllKeys():

More posts about AllKeys

Update 1. march 2012:

Additional annoyance: Did youknow, that F11 will be signaled as
WM_KEYDOWN VK_PROCESSKEY
WM_KEYUP VK_F11
so you can only rely on the keyup message for this function key. The translation of WM_KEYDOWN VK_F11 is done by the OS and cant be disabled, AFAIK.

2 Comments

  1. Burkhard Weeber says:

    Hello,

    do you still work on this ?
    There are Problems with Windows Server 2012R2 and the latest patches.
    After Login, there is nothing but a black Screen.

    regards

    Burkhard

  2. josef says:

    Hello Burkhard

    do you think “Windows Mobile – the no-go world of Function Keys” is the right post to place a comment about RDM not working with 2012R2 Terminal server?

    ~Josef

Leave a Reply