ActiveX (WebBrowser) and WebView2

Technical reference comparing both models for rendering web content inside a Harbour / HMG desktop application

StatusValidated technical reference
Technology / FormatCOM/OCX · Chromium (Edge)
Primary SourceMicrosoft · Harbour/HMG
GoalSelect and integrate the control

01 Introduction

ActiveX and WebView are not the same category of technology, which is why they are compared differently. ActiveX is a Microsoft technology for embedding components (controls) into Windows desktop applications—and formerly into Internet Explorer. WebView2 is an embedded browser control powered by Chromium and the Microsoft Edge runtime.

In practice, the legacy WebBrowser (ActiveX) control relied on the Internet Explorer rendering engine (Trident), which is now deprecated. WebView2 is its modern successor.

Primary use cases:

Scope

This document summarizes the analysis of both options. HMG integration specifics should be verified against your installed HMG/Harbour version (see Section 10).

02 The Two Models

2.1. ActiveX: Component Format

ActiveX is a component format (OCX/COM). The control runs with the current user's privileges, which historically created security concerns. Microsoft dropped ActiveX support in modern browsers, and Edge does not include it. Within Windows desktop applications, however, the COM container remains available and the legacy WebBrowser control is still present in the OS.

2.2. WebView2: Embedded Browser Control

WebView2 is a dedicated embedded browser control. It renders modern web content inside desktop applications using the Microsoft Edge (Chromium) runtime.

HMG Application Harbour Executable Wrapper / Control OCX / COM / DLL Browser Engine Trident (IE) or Chromium Web Content HTML / JS / HTTPS
General flow: the desktop application hosts a control that delegates rendering to the browser engine.

03 ActiveX WebBrowser (Legacy)

Security and Lifecycle

ActiveX controls run under the user's security context. Because the IE engine receives no feature updates, it is unsuitable for new projects.

04 WebView2 (Modern)

Runtime Dependency

Applications using WebView2 must verify that the runtime is installed on the target PC or bundle the Microsoft WebView2 bootstrapper/installer during deployment.

05 Comparison

FeatureActiveX WebBrowserWebView2
TypeCOM/OCX control (component format)Embedded browser control
EngineInternet Explorer (Trident)Chromium (Microsoft Edge)
StatusDeprecated, no feature updatesActive, maintained by Microsoft
InstallationPre-installed with WindowsRequires WebView2 Runtime (included in Windows 11)
Modern web (JS, CSS, HTTPS)Limited or brokenFull support
HMG supportNative (DEFINE ACTIVEX)Via third-party COM wrapper or C library
JavaScript & page ↔ host messagingLimitedYes (bidirectional messaging)
CostFreeCommercial COM wrappers may require a license
Recommended useSimple local HTML or legacy maintenanceNew projects

06 Usage in Harbour / HMG

HMG provides native support for hosting ActiveX/COM controls inside a window using the DEFINE ACTIVEX command (or its alternative @ row, col ACTIVEX ... syntax). Once created, the underlying OLE interface is accessed through the control's Object property.

Because Microsoft does not expose WebView2 directly as an ActiveX control, HMG applications connect to it either through third-party COM/ActiveX wrappers (such as SocketTools or AntView) using the exact same HMG container syntax with a different PROGID, or through a native C wrapper around the ICoreWebView2 API.

Example of an ActiveX wrapper over WebView2: docs.sockettools.com — WebView ActiveX control.

Harbour / HMG — Native ActiveX Container Syntax (hmg.ch)
#include "hmg.ch"

FUNCTION Main()

   DEFINE WINDOW Win_Main ;
      AT 0, 0 ;
      WIDTH 900 ;
      HEIGHT 650 ;
      TITLE "HMG — ActiveX / WebView2 Web Container" ;
      MAIN ;
      ON INIT LoadPage()

      // 1. Legacy WebBrowser (Trident): PROGID "Shell.Explorer.2"
      // 2. WebView2 Wrapper (e.g., AntView / SocketTools): replace PROGID
      DEFINE ACTIVEX oWeb
         ROW    10
         COL    10
         WIDTH  860
         HEIGHT 590
         PROGID "Shell.Explorer.2"
      END ACTIVEX

   END WINDOW

   CENTER WINDOW Win_Main
   ACTIVATE WINDOW Win_Main

RETURN NIL

STATIC PROCEDURE LoadPage()
   LOCAL oOle

   // Retrieve the COM object hosted inside the HMG ActiveX control
   oOle := Win_Main.oWeb.Object

   IF HB_ISOBJECT( oOle )
      // Optional: suppress legacy script error dialogs in Trident
      oOle:Silent := .T.
      oOle:Navigate( "https://example.com" )
   ENDIF

RETURN
HMG Implementation Notes
  • The .Object Property: In HMG, Win_Main.oWeb references the GUI wrapper control, whereas Win_Main.oWeb.Object returns the underlying OLE object (TOleAuto) used to invoke COM methods (Navigate, GoBack, Refresh, etc.).
  • COM Events: The built-in DEFINE ACTIVEX control in HMG 3.4.x / 3.6 hosts visual controls and exposes methods/properties, but does not provide direct COM event sink clauses inside the command block without extending the C wrapper or using Harbour's __axRegisterHandler() (hbwin).
  • WebView2 Wrappers: When using a commercial wrapper (such as AntViewAx.AntView or SocketTools.WebView.12), simply replace the PROGID string and adjust method calls according to the vendor's API reference.

07 Properties and Features

Summary of each model in a control specification format:

ActiveX WebBrowserTrident
  • Engine: Internet Explorer.
  • Dependencies: none.
  • Simple and internal HTML.
  • Limitations with modern web standards.
  • Permissions: current user context.
WebView2Chromium
  • Engine: Chromium / Edge.
  • Dependency: WebView2 Runtime.
  • Full modern web support.
  • JavaScript and page ↔ host messaging.
  • Third-party COM wrapper or C wrapper in HMG.

08 Recommendation

New Projects

Use WebView2, since the IE engine will receive no further improvements. Validate with a minimal test page first to confirm that both the runtime and wrapper behave as expected.

When to Keep ActiveX WebBrowser

Only for simple static/internal HTML or existing legacy modules that already work and do not require modern web capabilities.

09 Sources

ResourceLinkPurpose
WebView2 ActiveX Wrapperdocs.sockettools.comExample of a third-party COM/ActiveX wrapper
WebView2 DocumentationMicrosoft Learn (Edge WebView2)Runtime, system requirements, and deployment
HMG DocumentationReference Manual (DEFINE ACTIVEX)ActiveX control syntax in HMG
Note

References to Microsoft and HMG documentation serve as general technical pointers to verify against your exact compiler and wrapper versions.

10 Verification Plan

Test 1: RuntimeWebView2
  • Verify that the runtime is installed on the target PC.
  • Test across Windows 10 and Windows 11.
Test 2: Simple PageNavigation
  • Load a minimal HTML page inside the HMG control.
  • Confirm the wrapper initializes and responds.
Test 3: Modern WebJS / HTTPS
  • Load a modern HTTPS web application.
  • Compare rendering against ActiveX WebBrowser.
Test 4: MessagingJS ↔ Harbour
  • Execute JavaScript from Harbour code.
  • Receive web messages back from the page.
Test 5: DeploymentInstaller
  • Test on a clean PC without the runtime.
  • Define the runtime installation strategy.

11 Conclusion

ActiveX WebBrowser is a legacy component with zero external dependencies, but it is severely constrained by the deprecated Internet Explorer engine. WebView2 delivers Chromium and modern web standards, at the cost of requiring the WebView2 Runtime and a third-party COM wrapper (or C library) in Harbour/HMG.

For new projects, WebView2 is the recommended choice, validated early with a simple proof-of-concept page.