Windows Mobile 6.5 Web Browser Control: Enabling Gesture support

One of the most powerful controls in the Windows Mobile developer toolbox is the Web Browser control. With this control, you can create applications as simple as displaying HTML, to more complex apps that interact with the DOM manipulating elements, and fining / responding to events.

The introduction of touch and gesture support in Windows Mobile 6.5 has greatly improved the user experience. You can now intuitively flick and pan with your finger in most of the Microsoft applications and your own! Adding gesture support to your application is not trivial. See the Windows Mobile 6.5 Developer Tool Kit (DTK) for more information.  Fortunately Microsoft has included gesture support in the Web Browser control for 6.5

There are actually two web browsers in Windows Mobile 6.5. One that is used by Internet Explorer Mobile and another that is used by applications hosting the Web Browser control. This post will focus on the later.

There are two ways to instantiate the web browser control. The first method uses a COM interface to create the control. (See the miniPie SDK sample.) The second method hosts the control as a child of a DISPLAYCLASS window (The docs refer to this as the ‘HTML control’). In order to create this control with gesture support, you create it with the HS_NOSELECTION flag. For example:

hWndHtml = CreateWindow(TEXT("DISPLAYCLASS"), NULL,

        WS_VISIBLE | HS_NOSELECTION,0 , 0, GetSystemMetrics(SM_CXSCREEN),

        GetSystemMetrics(SM_CYSCREEN), hWnd, NULL, g_hInst, NULL);

You can see this for yourself:

  1. Open the Browse SDK sample
  2. Add the HS_NOSELECTION flag (as shown above) to the DISPLAYCLASS CreateWindow call
  3. Build and Run

In the video below, I changed the sample to load an HTML file that contained more than a screen full of data in order to force scrolling so that you can see the navigation via gestures (Flick and Pan):

Additional Resources:

Note that the information above is not documented by Microsoft and is therefore not supported. Tags: ,,

Leave a Reply

Your email address will not be published. Required fields are marked *