Windows Mobile 6.5 Embedded Browser Controls

This article explores the specific controls developers used to embed web browsing capabilities directly into Windows Mobile 6.5 applications. It covers the native Win32 HTML Viewer control (WC_HTML), the COM-based ActiveX WebBrowser control (IWebBrowser2), and the managed System.Windows.Forms.WebBrowser component provided by the .NET Compact Framework.

The Native HTML Viewer Control (WC_HTML)

For native C and C++ development on Windows Mobile 6.5, the primary lightweight component for rendering HTML was the HTML Viewer control. It was implemented as a custom window class identified by the constant WC_HTML (defined in htmlctrl.h).

Developers initialized and embedded this control using standard Win32 API conventions:

  1. Initialization: The application loaded the control library by calling InitHTMLControl(hInstance).
  2. Creation: A window instance was created using CreateWindow or CreateWindowEx, specifying WC_HTML as the window class name.
  3. Control and Messaging: Communication with the control occurred via specific window messages, such as:
    • DTM_NAVIGATE to instruct the control to open a specified URL or local file path.
    • DTM_ADDTEXT to feed raw HTML text directly into the viewer buffer.
    • DTM_CLEAR to wipe the current document state.

While highly resource-efficient, the legacy WC_HTML control supported a limited subset of standard HTML and lacked modern script interpretation.

The WebBrowser ActiveX Control (IWebBrowser2)

Windows Mobile 6.5 featured an upgraded browser engine based on Internet Explorer 6 desktop technology (Trident). To leverage full CSS, JavaScript, and dynamic rendering, developers embedded the browser as an ActiveX control hosting the IWebBrowser2 COM interface.

  • Engine: Powered by the Trident layout engine (mshtml.dll).
  • Implementation: The host application created an ActiveX container window to host the CLSID_WebBrowser class.
  • Capabilities: Exposed full Document Object Model (DOM) manipulation, event handling (such as navigation cancellation and page-load triggers), and execution of client-side scripts.

The .NET Compact Framework WebBrowser Control

For managed development targeting Windows Mobile 6.5 with C# or Visual Basic .NET, Microsoft provided the System.Windows.Forms.WebBrowser control inside the .NET Compact Framework 2.0 and 3.5.

  • Architecture: This control served as a managed wrapper around the underlying mobile WebBrowser component.
  • Key Members:
    • Url: Gets or sets the target Uri for navigation.
    • Navigate(string url): Loads the webpage at the specified address.
    • DocumentText: Allows developers to assign raw HTML strings directly for display.
    • Navigating and DocumentCompleted: Events to monitor page requests and finalize rendering.

By choosing between the lightweight WC_HTML control and the full-featured WebBrowser control, developers balanced memory constraints with the required level of web standards support on Windows Mobile 6.5 devices.