Downloads Compatibility Release Notes Editions Licensing Support Getting Started Samples

WebKitX ActiveX for CEF3

This is a Visual Studio 2015 C++11 MFC/ATL x86 ActiveX that wraps Chromium Embedded Framework (CEF3) version 3.3202.1692 (December 2017) for use with OLE/COM languages. Chromium Embedded Framework encapsulates WebKit Blink HTML5 Renderer and Google V8 JavaScript VM Engine. This is a production-grade stable component for commercial use that will truly add HTML5 features in your Desktop and Terminal Applications.

Key Features

Downloads

Download WebKitX ActiveX for CEF3 version 1.5.11.2664
MD5: ac58bc81be8819067ca4bb26619ae71b
SHA-1: 2e434218743cb5d170fb76210dd5b97b08e21aa1

Complete installation package for Windows 7, 8, 10 (x86, works on x64 too). Includes WebKitX ActiveX, CEF 3.3202.1692 binariesHTML5 Editor VB6 Sample (both source / binary) and Microsoft x86 C++ 2015 Redistributable Package v.14.0.24123.

Compatibility

Even though the control is promoted and supported only for Visual Basic 6.0 SP6, it is compatible with any OLE/COM capable Integrated Development Environments and x86 programming language. The following programming languages and IDE are reported to be compatible with WebKitX:

Release Notes

12 Jun 2018

12 May 2018

12 Apr 2018

Evaluation & Distribution

Installation

Download the setup package and install it in a place like C:\Program Files (x86)\WebKitX CEF3 ActiveX and you are ready to start using the component.

Evaluation

You are welcome to evaluate WebKitX for as long as you want and feel free to contact us with your questions, your suggestions and your bounties!  During evaluation, when opening a URL and at random intervals WebKitX displays a message box informing you that it is a commercial product and that it requires a License, but it wont prevent you from using all its features.

Commercial License Activation

If you own a commercial license of WebKitX ActiveX control, you need to add in your program your License Key.
Add this line in your code: WebKitX1.Activate "your@email", "yourkey"

Commercial Distribution

Creating a setup script to install WebKitX on a different computer should be straight-forward:

  1. Your script must copy the files of the C:\Program Files (x86)\WebKitX CEF3 ActiveX\bin folder to the other computer (list below).
    The destination folder is irrelevant and can be anywhere you choose.
  2. Your script must run Microsoft Visual C++ 2015 Redistributable Package (x86) for the Windows OS and Service Pack bundle of the other computer.
    For detailed information please see the WebKitX Runtime Dependencies paragraph above.
  3. Your script must register WebKitX ActiveX into the Windows Registry using this command: regsvr32 /s WebKitXCEF3.ocx
  4. If your product does not use Chrome DevTools, you may skip devtools_resources.pak to decrease size.
  5. If your product uses Flash Player you should add pepflashplayer32_29_0_0_113.dll (not included in WebKitX).

The binary payload of WebKitX consists of the following files and folders, all located in the ./bin folder:

WebKitX Runtime Dependencies

WebKitX requires Microsoft x86 C++ 2015 Runtime. During installation WebKitX setup will automatically install Microsoft x86 C++ 2015 Redistributable Package v.14.0.24123 for the following list of Windows Operating Systems:

Please note that OS-related compatibility issues are not subject to support and you must refer to Chromium Embedded Framework (CEF3) Operating System and Service Pack compatibility notes for aid.

What is Microsoft Visual C++ 2015 Redistributable Package?

Microsoft Visual C++ 2015 Redistributable installs run-time components of Visual C++ libraries. These components are required to run C++ applications that are developed using Visual Studio 2015 Update 3 RC and link dynamically to Visual C++ libraries. The packages can be used to run such applications on a computer even if it does not have Visual Studio 2015 installed. These packages also install run-time components of C Runtime (CRT), Standard C++, MFC, C++ AMP, and OpenMP libraries.Microsoft Visual C++ 2015 Redistributable includes bug fixes to the runtime DLLs and also the latest versions for KB 2999226. To find out what's new in Visual Studio 2015 Update 3 RC, see the Visual Studio 2015 Update 3 RC Release Notes.

WebKitX installation Fails. What can I do? IMPORTANT NOTE

If during WebKitX installation you get an error message that WebKitXCEF3.ocx and cmax40.dll failed to register, it most certainly means that  Microsoft x86 C++ 2015 Redistributable Package failed to automatically install because the Windows OS version and/or its current Service Pack are not compatible with the included Microsoft x86 C++ 2015 Redistributable Package. You are advised to download Microsoft x86 C++ 2015 Redistributable Package for you Operating System and Service Pack bundle, and install it manually, from here: Microsoft Visual C++ 2015 Redistributable Update 3 RC.

Where can I find CEF3 binaries?

CEF3 binaries bundle can be also downloaded separately from here:
http://opensource.spotify.com/cefbuilds/index.html#windows32_builds
* WebKitX is tested and supported with cef_binary_3.3202.1692.g18a939d_windows32

WebKitX Editions

Which WebKitX edition do I need?

WebKitX ActiveX ships in two flavors: HTML5 Browser-only for adding HTML5 browsing capabilities in your applications, and HTML5 Browser & Editor for adding HTML5 What-You-See-Is-What-You-Get editing capabilities to your applications. For checking-out WebKitX editing features we recommend running the compiled sample HTML5 Editor.

WebKitX Browser Edition

Please note that HTML5 Browser Edition of WebKitX allows you to open URLs, read/write HTML5, receive  HTML5 events in your application, but it does not support HTML manipulation, nor JavaScript injection, nor JavaScript execution (Eval, AddScript, AddCode, JSCallback, DispatchEvent). The intended use of the Browser Edition of WebKitX is to render HTML5 from within your application such as Web Sites, WebGL Games, Help Files and Documentation, Sales and other Reports, RSS and News Feeds, HTML5 Videos, Facebook, Twitter tweets, PDF Files, Flash Content, etc.

WebKitX Editor & Browser Edition

If your application requires HTML5 manipulation, rich text editing, and/or JavaScript injection and execution, usage of Eval, AddScript, AddCode, JSCallback, DispatchEvent methods,  please consider using the HTML5 Browser & Editor edition of WebKitX. Despite being an HTML5 Editor, the control offers you its Editing API even in Browser Mode.

Choose your License based on API usage

Below is a list of all WebKitX API Methods and Properties and the License required in order to call them at run-time. Please check carefully if the methods you require for your application are covered by the licensing you choose. Please do not hesitate to contact us at info@mobilefx.com for assistance or clarifications.

API Method / Property Required License
CreateBrowser or Editor
RepaintBrowser or Editor
GetBrowserReadyBrowser or Editor
AddEventListenerBrowser or Editor
AddEventListenerExBrowser or Editor
RemoveEventListenerBrowser or Editor
RemoveEventListenerExBrowser or Editor
DispatchEventEditor
GethWndBrowser or Editor
GethWndBrowserBrowser or Editor
GetModifiedEditor
SetModifiedEditor
GetEventsBrowser or Editor
SetEventsBrowser or Editor
GetActiveElementEditor
GetSelAnchorElementEditor
GetSelFocusElementEditor
GetExecCommandSetFocusEditor
SetExecCommandSetFocusEditor
GetFormatUsingInternalSelectionAPIEditor
GetDownloadScriptsBrowser or Editor
GetIPC_TIMEOUT_MILLISBrowser or Editor
SetIPC_TIMEOUT_MILLISBrowser or Editor
GetASYNC_EVENTSBrowser or Editor
SetASYNC_EVENTSBrowser or Editor
GetFireOnEventForAllEventsBrowser or Editor
SetFireOnEventForAllEventsBrowser or Editor
SetDownloadScriptsBrowser or Editor
SetFormatUsingInternalSelectionAPIEditor
GetSpellCheckingEditor
SetSpellCheckingEditor
OpenBrowser or Editor
NavigateBackBrowser or Editor
NavigateForwardBrowser or Editor
StopLoadingBrowser or Editor
SaveHTMLBrowser or Editor
SavePDFBrowser or Editor
GetCurrentURLBrowser or Editor
GetURLBrowser or Editor
SetURLBrowser or Editor
GetBaseURLBrowser or Editor
SetBaseURLBrowser or Editor
GetHTMLBrowser or Editor
SetHTMLBrowser or Editor
EditEditor
PreviewBrowser or Editor
PrintBrowser or Editor
GetPreferenceBrowser or Editor
SetPreferenceBrowser or Editor
EvalEditor
JSCallbackEditor
CallByNameEditor
ExecCommandEditor
AddScriptEditor
AddCodeEditor
ShowDevToolsBrowser or Editor
DownloadBrowser or Editor
CancelDownloadBrowser or Editor
GetUndoEnabledBrowser or Editor
SetUndoEnabledBrowser or Editor
GetUndoObserverEnabledEditor
SetUndoObserverEnabledEditor
ClearUndoEditor
GetUndoSizeEditor
GetRedoSizeEditor
GetCanUndoEditor
GetCanRedoEditor
CommitEditor
UndoEditor
RedoEditor
SelectElementEditor
SelectTableColumnEditor
GetStyleEditor
SetStyleEditor
GetCssTextEditor
SetCssTextEditor
GetAttributeEditor
SetAttributeEditor
RemoveAttributeEditor
GetAttributesEditor
SetAttributesEditor
GetInnerHTMLEditor
SetInnerHTMLEditor
GetOuterHTMLEditor
SetOuterHTMLEditor
DeleteEditor
GetSelHTMLEditor
GetSelFontNameEditor
GetSelFontSizeEditor
GetSelFontColorEditor
GetSelFontBackColorEditor
GetSelTextEditor
GetSelTypeEditor
SelCollapseToEndEditor
SelCollapseToStartEditor
SelDeleteEditor
SelEmptyEditor
SelAllChildrenEditor
DeselectEditor
SetSelHTMLEditor
SetSelFontNameEditor
SetSelFontSizeEditor
SetSelFontColorEditor
SetSelFontBackColorEditor
SetSelTextEditor
SetSelFontBoldEditor
SetSelFontItalicEditor
SetSelFontUnderlineEditor
SetSelStrikeThroughEditor
GetSelFontBoldEditor
GetSelFontItalicEditor
GetSelFontUnderlineEditor
GetSelStrikeThroughEditor
GetSelCollapsedEditor
SelContainsNodeEditor
SelExtendEditor
GetSelectionEditor
SetSelectionEditor
ReplaceTextEditor
TidyHTMLEditor

WebKitX Licensing

Desktop Application License

In a nutshell, a single License allows you to develop an unlimited number of Desktop Applications linked with WebKitX ActiveX control and distribute them freely to an unlimited number of your customers. The license excludes specific terminal-based applications that are subject to Terminal Application License below.

Edition Commercial Use Price Buy Now
WebKitX HTML5 Browser (x86) Yes £ 399
WebKitX HTML5 Editor (x86) Yes £ 999

Do I need additional Licenses?

If your application is installed and executed on Windows Desktop operating systems such as Windows 7, 8, 10 and Windows Server editions, then you only need the Desktop Application License; to be absolutely clear about this, if your application is installed and executed on Windows Desktop operating systems such as Windows 7,8,10 and Windows Server editions, then you do not need Terminal Licenses.

You will need Terminal Licenses only if your application will be installed and executed on Windows Embedded operating systems, or executed under a Terminal Server.

Terminal Application License

Complementary to Desktop Application License are Terminal Licenses

A Terminal License is required if your application is deployed on a  Windows Embedded operating system or under a Terminal Server. A Terminal License must be obtained per terminal, on top of the Browser or Editor license. There are (3) types of terminal applications distinguished in the licensing terms:

The Point of Sales Terminal License is the General Purpose Terminal License for all terminal applications not explicitly stated in the list above.

Please contact us for Terminal License Volume Quotation.


Terminal License Commercial Use TermsIndicative Annual
OPEX Price
Volume License Quotation
Video Lottery Terminal License Yes CAPEX or OPEX£ 5
Contact us
Digital Signage Player License Yes CAPEX or OPEX£ 3
Contact us
Point of Sales Terminal License Yes CAPEX or OPEX£ 1
Contact us

Terminal Application License Premium Support Services

License Agreement

Please read carefully our license agreement and do not hesitate to contact us if you have questions, or if you need to negotiate special closures. 
mobileFX Software End-User License Agreement for WebKitX ActiveX Control

Can I upgrade my Browser License to Editor License?

Yes you can! you can upgrade your license within 15 days from purchase, paying only the difference. This upgrade service is only available for purchases made through our web site and not for purchases made by our distributors. Please contact sales@mobilefx.com for an upgrade.

Can I get the Source Code?

Yes you can! In fact we do not just give you the source code, we give you access to our git repository so that you can get all the latest fixes and features of our work in real-time.

Service Commercial Use Price
WebKitX Source Code Yes £ 25,000
Support Voucher / Bounty 1 hour £ 50

Support Services

What is Support Voucher / Bounty?

If you desperately need a new feature implemented in WebKitX or immediately need a hotfix and can't wait until next release, you can contact us at info@mobilefx.com and negotiate with us a price, for which we will stop what we do and take care of what you need! The service is called a Bounty and applies only to existing Customers; for any edition of the ActiveX but only for its latest version (we do not branch per customer).

Just send us an email with what you need and our Account Manager will pass your request to our Tech Lead for Effort Estimation along with Technical Specs of the works to be done. Effort Estimation is in man hours and it is different from Duration. For example, to add a feature it might take our expects 8 hours to implement, but because we work on Sprints we might need a duration of one week to deliver.

The catch is that you participate in the process, being the primary Beta Tester! This phase is called User Acceptance Testing (UAT) and during this period you receive code-locked prototype revisions and provide us with valuable feedback, such as UAT observations and Defects. Once UAT is completed and you are satisfied with the result, you release us from the Bounty and we provide you with an Unlock Code as a token of our appreciation.

For corporate customers and long projects we collaborate using Jira.

WebKitX Architecture

WebKitX CEF3 ActiveX is a light-weight MFC ATL component for use with OLE/COM Programming Languages. At runtime the ActiveX starts CEF3XClient.exe process, passing to it its Window Handle (hWnd). 

CEF3XClient Process starts CEF3 Browser and Render sub-processes and establishes a seamless back-to-back Interprocess Communication Mechanism (IPC) between the ActiveX and all CEF3 processes. Chrome Browser is parented in ActiveX hWnd but lives in its own process.

All COM-based method and property calls between the ActiveX and CEF3XClients are marshalled using CoWaitForMultipleHandles, allowing your application's UI to be responsive. For time-consuming tasks, such as URL loading, COM events provide you callbacks when the tasks are finished. 

The important aspect of this architecture design is that all WebKit HTML5 rendering and V8 JavaScript execution are taking place outside your application, offering your application stability and isolation.

WebKitX Initialization

Form_Load()

First you must activate WebKitX ActiveX by providing your License Key. If you are using early binding, a good place to do that is on Form_Load event. If you are using late binding you are advised to activate the control straight after its creation. This step applies only to license owners. During trial evaluation of WebKitX you may skip it.

WebKitX1_OnCreate(Settings, CommandLineSwitches)

Next you may control the creation of CEF3 Browser and Client Processes. OnCreate event provides you a Settings object that controls CEF3 Application and CEF3 Browser creation and initialization settings. The recommended defaults are preset in this object but you may want to provide your own settings such as Localization, Cache paths, Security settings, etc. The second parameter is CommandLineSwitches that are additional CEF3 preferences and even JavaScript flags that you want to provide to CEF3 Client Processes. 

For a list of command line switches please have a look here:  https://peter.sh/experiments/chromium-command-line-switches

WebKitX1_OnBrowserReady()

OnBrowserReady event notifies you that CEF3 processes and WebKitX control have been successfully created and the Interprocess Communication Mechanism (IPC) is established. At this point you can define secondary behavioral parameters such as focus control, formatting APIs, script downloading control, etc. but most importantly after OnBrowserReady event you can successfully start loading URLs for browsing or editing.

WebKitX1_OnLoadEnd()

OnLoadEnd event is fired when your URL is completely downloaded. At this point you can enable HTML5 Editing or Preview (Browsing) and set the HTML DOM events you want WebKitX to subclass for every HTML Element on the document. After you receive this event you can start using the Selection and Formatting APIs.

Nothing Paints on my Form. What can I do? TROUBLESHOOTING

WebKitX ActiveX provides OLE Control Host Window Handle (HWND) to Chromium Embedded Framework (CEF3), which in turn paints the HTML5 composite image to the OLE Control Host Device Context (HDC). This mechanism requires you to Disable Double Buffering Features of the Host Form or OLE Control Host. Furthermore please make sure you set the scale mode of your Host Form or OLE Control Host to Pixels.

WebKitX Behavior Configuration IMPORTANT NOTES

Enabling JavaScript 

Please note that in WebKitX downloading <script> tags is disabled by default because in editor mode JavaScript execution often messes with HTML5 styles, especially if you are using features such as Parallax Scrolling and JavaScript-aided responsive layouts. If you want to download and execute JavaScript you must explicitly enable it using  WebKitX1.DownloadScripts = True in OnBrowserReady() event handler, as illustrated in code fragment below. 

As a side note, in editor edition of WebKitX you can execute JavaScript at run-time using Eval, AddScript, AddCode and ExecuteCommand methods, even if DownloadScripts is false. The key difference is download-time and run-time JavaScript execution and WebKitX DownloadScripts parameter controls download-time JavaScript and not run-time JavaScript.

Disabling GPU

In WebKitX GPU Hardware Acceleration is enabled by default. However, there are cases that you might need to host your application in a Virtualized environment such as VMware, Citrix or Virtual Box where GPU emulation is not available. You may disable GPU by handling the OnCreate() event and adding --disable-gpu --disable-webgl --disable-3d-apis --disable-gpu-compositing in CommandLineSwitches and setting Settings.webgl = False.

Setting HTML5 by code at Runtime

WebKitX offers your two ways to load HTML: either by WebKitX.Open() method or by WebKitX.HTML property. Please note that providing a URL is recommended for successfully downloading relative resources such as Images, Style Sheets, Scripts, etc. If however you need to use the WebKitX.HTML property you first need to set a fake-but-valid URL and BaseURL. Chromium Embedded Framework Browser requires a valid URL page before you can inject HTML and/or JavaScript by code at run-time. To do so please use the WebKitX.URL and WebKitX.BaseURL properties before you use the WebKitX.HTML property.

Setting CEF3 Preferences at Runtime

WebKitX offers GetPreference() and SetPreference() methods to read / modify CEF3 preferences at run-time. Please note that setting preferences causes CEF browser to recreate and it is time-costly, so use it with caution, especially when synchronizing WebKitX HTML with a Code Editor (like HTML5 Pad does). For example to enable / disable Spell Checking, WebKitX uses an internal Boolean latch in order to avoid browser recreation and you should use WebKitX1.SpellChecking = true instead of SetPreference("browser.enable_spellchecking", "true").

For a list of preference please have a look here: https://src.chromium.org/viewvc/chrome/trunk/src/chrome/common/pref_names.cc?view=markup

WebKitX Plugins

WebKitX plugins are disabled by default in both Browser and Editor editions. To enable plugins you need to handle the OnCreate event and set Settings.plugins = True as illustrated below:

PDF Viewer Plugin

When plugins are disabled PDF files will download as regular files rather than render on the screen. To enable PDF Viewer you need to handle the OnCreate event and set Settings.plugins = True.

Flash Player Plugin

To enable Flash player you need to download a x86 version of pepflashplayer.dll and provide the path to it by setting the Settings.flash_player_dll_path property in OnCreate() event, as illustrated below. If you copy the DLL in the ActiveX folder then you do not need to provide the full path. If you decide to install the DLL in a different folder you should provide the path with forward slashes (unix-style paths).

Chrome DevTools Plugin

Chrome DevTools is a set of web developer tools built directly into the Google Chrome browser. DevTools can help you diagnose problems quickly, which ultimately helps you build better websites, faster.

HTML5 DOM to COM Events

Selector based API

WebKitX provides you access to  HTML5 DOM through a robust  CSS3 selector-based API (Selector example td:nth-of-type(3) > span:first-child Selectors are used as arguments in editing and styling method calls and as targets in events. The ActiveX provides the selector of the currently selected element and the begin and end nodes of the current selection: ActiveElement, SelAnchorElement, SelFocusElement.

Asynchronous DOM to COM Events

HTML5 DOM Events are generated by WebKit Blink Engine and are copied into an immutable format before they are transmitted from CEFXClient process to WebKitX ActiveX. Once WebKitX ActiveX receives an event notification through IPC, it fires a COM Event with the copied data of HTML DOM event. Thus, CEFXClient process does not block waiting for your client code to handle the event. WebKitX DOM Events are Immutable, meaning that you can only read event data but you cannot cancel events, stop them from bubbling or prevent default behavior. 

Synchronous DOM to COM Events

WebKitX as of version 1.5.11.2591 supports synchronous DOM to COM events by implementing CefMessageRouter circuit. Events generated from WebKit Blink Engine are serialized and passed from Rendering to Browser process, which transmits them to the ActiveX. The browser process waits for the ActiveX to handle the event, where you can also cancel event bubble or prevent event's default behavior.

Please note that blocking Inter-process Communication (IPC) between 3 processes is not advisable for casual event handling and you should do so only if you need to cancel specific events. Synchronous DOM to COM Events are thread-safe and care has been placed in order to support this feature seamlessly in single-threaded Applications without deadlocks. For that purpose, synchronous events are serialized using mutex synchronization on entry, meaning that synchronous events occupy the IPC channel one at a time. Please contact us for more implementation details or if you need a different handling of DOM to COM events.

Listening to DOM Events

You can use addEventListener and removeEventListener for attaching and detaching on HTML DOM events. WebKitX offers two methods:

The signature of the public methods is defined by OnEvent() event which is:

EventData are a JSON string representation of DOM Event:

{ "eventName": "click", "eventType": "[object MouseEvent]", "altKey": false, "bubbles": true, "button": 0, "buttons": 0, "cancelBubble": false, "cancelable": true, "clientX": 86, "clientY": 178, "composed": true, "ctrlKey": false, "currentTarget": "", "defaultPrevented": false, "detail": 1, "eventPhase": 1, "fromElement": "", "isTrusted": true, "layerX": 86, "layerY": 178, "metaKey": false, "movementX": 0, "movementY": 0, "offsetX": 86, "offsetY": 89, "originalTarget": "", "pageX": 86, "pageY": 178, "path": "#lga", "relatedTarget": "", "returnValue": true, "screenX": 566, "screenY": 415, "shiftKey": false, "srcElement": "#lga", "sourceCapabilities": {}, "target": "#lga", "timeStamp": 8625.205000000002, "toElement": "#lga", "type": "click", "which": 1, "x": 86, "y": 178, "region": null, }
{ "eventName": "mousemove", "eventType": "[object MouseEvent]", "altKey": false, "bubbles": true, "button": 0, "buttons": 0, "cancelBubble": false, "cancelable": true, "clientX": 136, "clientY": 1, "composed": true, "ctrlKey": false, "currentTarget": "", "defaultPrevented": false, "detail": 0, "eventPhase": 1, "fromElement": "", "isTrusted": true, "layerX": 136, "layerY": 1, "metaKey": false, "movementX": -1, "movementY": -2, "offsetX": 136, "offsetY": 1, "originalTarget": "", "pageX": 136, "pageY": 1, "path": "#viewport", "relatedTarget": "", "returnValue": true, "screenX": 616, "screenY": 238, "shiftKey": false, "srcElement": "#viewport", "sourceCapabilities": {}, "target": "#viewport", "timeStamp": 276604.28, "toElement": "#viewport", "type": "mousemove", "which": 0, "x": 136, "y": 1, "region": null, }

DOM Events Handling Example

WebKitX Events Sample demonstrates handling DOM events and reading values from Input elements. In the following code fragment are demonstrated the three (3) different methods you can use. The generic method, the AddressOf method that requires a Module, and the IDispatch method that requires an Object. The sample loads a INPUT element and a BUTTON and when you click the button it fires an event which is handled by VB6. The event handler code in VB6 uses WebKitX API to read the value of the INPUT.



Firing Custom HTML5 Events - DispatchEvent()

WebKitX DispatchEvent() method allows you to fire DOM events directly into JavaScript and handle those events by JavaScript event handlers. You can pass the target selector that will receive the event, the event name, event initialization parameters (bubbling, cancelable, composed) and an OLE/COM Variant that will be converted into a V8 JavaScript object and added in the details field of the Event object. Event execution can be both synchronous and asynchronous in terms of IPC tunneling, and it is always synchronous in terms of DOM.

Calling JavaScript

Calling JavaScript Functions by Name - CallByName()

The simplest way to call a JavaScript function by name in WebKitX is WebKitX.CallByName(Name, Variant) method. You can pass to JavaScript function arbitrary arguments using an OLE/COM Variant, and receive the function's result value, as an OLE/COM Variant too. Execution of CallByName is IPC-synchronous. This is an elegant alternative to WebKitX.Eval() code as you can pass back-and-forth your variables without stringifying them. For more information about this mechanism have a look in OLE/COM Variants to V8 Values Conversion.

Calling JavaScript Functions for a Specific Execution Context -  JSCallback()

WebKitX JavaScript Callbacks is a mechanism to register and call JavaScript functions by name, within a specific V8 JavaScript Execution Context. The key difference from CallByName() is that CallByName can only invoke functions registered in the Global Scope of the Main Window, where as JavaScript Callbacks allow you to call functions registered in any scope and window.

Registering JavaScript Callbacks

Each frame in a browser window has its own V8 context. The context defines the scope for all variables, objects and functions defined in that frame. WebKitX allows you to register a JavaScript callback in a V8 context using window.register(name, callback, this) method. The first argument is the string name of the function, the second is the function callback and the 3rd optional parameter is the execution context. If the 3rd parameter is not defined then the global object is assumed.

Invoking JavaScript Callbacks

To invoke the JavaScript callback you simply need to call WebKitX.JSCallback(name, params, async) method passing the name of the JavaScript function you want to invoke and a Variant with the arguments. For critical real-time applications you should set async parameter to True, which executes the IPC call synchronously. The result depends on the JavaScript function and can be either a scalar value or a variant array of variants.

OLE/COM Variants to V8 Values Conversion EXPERIMENTAL

WebKitX has a powerful OLE/COM Variant to Google V8 Value bi-directional converter that works both for Scalar and Array values, including nested array values (arrays of arrays of variants). This conversion mechanism is available to any WebKitX method transmitting and/or returning an OLE/COM Variant, such as CallByName(), JSCallBack() and DispatchEvent().

WebKitX can serialize variant scalars VT_BSTR, VT_UINT, VT_INT, VT_NULL, VT_BOOL, VT_R4, VT_R8, VT_CY, VT_DATE as well as variant safearray of variants VT_ARRAY|VT_VARIANT and even typed arrays VT_ARRAY|VT_BSTR, VT_ARRAY|VT_UINT, VT_ARRAY|VT_INT, VT_ARRAY|VT_BOOL, VT_ARRAY|VT_R4, VT_ARRAY|VT_R8, VT_ARRAY|VT_CY, VT_ARRAY|VT_DATE to Google V8 value objects. Currently serialization of VT_DISPATCH is not supported and therefore you cannot pass OLE/COM Objects to JavaScript.

On the OLE/COM side, to pass multiple arguments to a JavaScript callback function you need to wrap them in a Variant Array of Variants.

On the JavaScript side, you can return V8 Scalar or V8 Array values to OLE/COM side, including nested V8 Arrays. WebKitX can serialize V8 scalar Boolean, Number, String, Null, Date values and Array of [Boolean or Number or String or Null or Date or Array] V8 values. Google V8 Arrays are always returned as Variant Arrays of Variants.

On the receiving OLE/COM side the scalars are converted to a Variant of equivalent scalar type and Arrays are converted into a Variant Array of Variants.

WebKitX HTML5 Editor

There are some best practices when using WebKitX as an HTML5 Editor:

Disabling JavaScript download

Disabling scripts downloading is advisable when using WebKitX as an Editor because JavaScript execution often messes with HTML5 styles, especially if you are using features such as Parallax Scrolling and JavaScript-aided responsive layouts.

Detecting Edit Mode from JavaScript

There are cases where your JavaScript code might need to detect if WebKitX is in Edit mode. To do that simply read window.__WEBKITX_EDITABLE__ variable. You should wrap Google Analytics and Google Tags Manager initialization code inside a conditional block and download Google scripts (or any other script) by URL, as illustrated below:

Using WebKitX with MDI Forms

MDI Forms in most programming languages suffer from flickering effects. When using WebKitX in an MDI child Form, you may notice rendering problems when MDI children overlap each other during resizing or moving. To treat this problem you need to add WebKitX.SetMDIWindow(hWND) in every MDI child Form that uses WebKitX control. The call installs a window sub-class hook that detects WM_WINDOWPOSCHANGING and WM_MOVING messages and repaints the entire MDI Form. In order to avoid further flickering and redundant repaints, WebKitX uses Timer that absorbs repeated WM_WINDOWPOSCHANGING and WM_MOVING messages. For SetMDIWindow() to work, the WebKitX control must be directly placed inside an MDI Form and must not be contained inside another control (such as a TabStrip).

WebKitX COM Interfaces

// WebKitXCEF3.idl : type library source for ActiveX Control project.

// This file will be processed by the MIDL compiler tool to
#include <olectl.h>
#include <idispids.h>

import "ocidl.idl";
import "oaidl.idl";

[
	uuid(316AC43B-854D-415B-AC7D-637569B2D263),
	version(1.0),
	control,
	helpstring("mobileFX WebKitX CEF3 ActiveX")
]
library WebKitXCEF3Lib
{
	importlib(STDOLE_TLB);

	typedef enum DOM_EVENTS
	{
		DOM_EVENT_NONE							= 0,
		DOM_EVENT_CLICK							= 1,
		DOM_EVENT_DBLCLICK						= 2,
		DOM_EVENT_MOUSE_DOWN					= 4,
		DOM_EVENT_MOUSE_MOVE					= 8,
		DOM_EVENT_MOUSE_UP						= 16,
		DOM_EVENT_KEY_DOWN						= 32,
		DOM_EVENT_KEY_PRESS						= 64,
		DOM_EVENT_KEY_UP						        = 128,
		DOM_EVENT_CUT							= 256,
		DOM_EVENT_COPY							= 512,
		DOM_EVENT_PASTE							= 1024,
		DOM_EVENT_SELECT						        = 2048,
		DOM_EVENT_SELECTSTART					= 4096,
		DOM_EVENT_SELECTION_CHANGE				= 8192,
		DOM_EVENT_DOMFOCUSIN					= 16384,
		DOM_EVENT_DOMFOCUSOUT					= 32768,
		DOM_EVENT_DOMNODEINSERTED				= 65536,
		DOM_EVENT_DOMNODEREMOVED				= 131072,
		DOM_EVENT_DOMNODEINSERTEDINTODOCUMENT	= 262144,
		DOM_EVENT_DOMNODEREMOVEDFROMDOCUMENT	= 524288,
		DOM_EVENT_DOMSUBTREEMODIFIED			        = 1048576,
		DOM_EVENT_DOMCHARACTERDATAMODIFIED		= 2097152,
		DOM_EVENT_EDITABLE_ELEMENT_CHANGED		= 4194304,

	} DOM_EVENTS;

	typedef enum EVENT_CONSTRUCTORS
	{
		CustomEvent = 0,
		AnimationEvent,
		AudioProcessingEvent,
		BeforeInputEvent,
		BeforeUnloadEvent,
		BlobEvent,
		ClipboardEvent,
		CloseEvent,
		CompositionEvent,
		CSSFontFaceLoadEvent,
		DeviceLightEvent,
		DeviceMotionEvent,
		DeviceOrientationEvent,
		DeviceProximityEvent,
		DOMTransactionEvent,
		DragEvent,
		EditingBeforeInputEvent,
		ErrorEvent,
		FetchEvent,
		FocusEvent,
		GamepadEvent,
		HashChangeEvent,
		IDBVersionChangeEvent,
		InputEvent,
		KeyboardEvent,
		MediaStreamEvent,
		MessageEvent,
		MouseEvent,
		MutationEvent,
		OfflineAudioCompletionEvent,
		PageTransitionEvent,
		PointerEvent,
		PopStateEvent,
		ProgressEvent,
		RelatedEvent,
		RTCDataChannelEvent,
		RTCIdentityErrorEvent,
		RTCIdentityEvent,
		RTCPeerConnectionIceEvent,
		SensorEvent,
		StorageEvent,
		SVGEvent,
		SVGZoomEvent,
		TimeEvent,
		TouchEvent,
		TrackEvent,
		TransitionEvent,
		UIEvent,
		UserProximityEvent,
		WebGLContextEvent,
		WheelEvent,
	} EVENT_CONSTRUCTORS;


	typedef enum DOM_NODE_TYPES
	{
		DOM_NODE_TYPE_UNSUPPORTED = 0,
		DOM_NODE_TYPE_ELEMENT,
		DOM_NODE_TYPE_ATTRIBUTE,
		DOM_NODE_TYPE_TEXT,
		DOM_NODE_TYPE_CDATA_SECTION,
		DOM_NODE_TYPE_PROCESSING_INSTRUCTIONS,
		DOM_NODE_TYPE_COMMENT,
		DOM_NODE_TYPE_DOCUMENT,
		DOM_NODE_TYPE_DOCUMENT_TYPE,
		DOM_NODE_TYPE_DOCUMENT_FRAGMENT,
	} DOM_NODE_TYPES;

	typedef enum NAV_RESOURCE_TYPE
	{
		RT_MAIN_FRAME = 0,
		RT_SUB_FRAME,
		RT_STYLESHEET,
		RT_SCRIPT,
		RT_IMAGE,
		RT_FONT_RESOURCE,
		RT_SUB_RESOURCE,
		RT_OBJECT,
		RT_MEDIA,
		RT_WORKER,
		RT_SHARED_WORKER,
		RT_PREFETCH,
		RT_FAVICON,
		RT_XHR,
		RT_PING,
		RT_SERVICE_WORKER,
		RT_CSP_REPORT,
		RT_PLUGIN_RESOURCE,
	} NAV_RESOURCE_TYPE;

	typedef enum NAV_TRANSITION_TYPE 
	{
		TT_LINK = 0,
		TT_EXPLICIT = 1,
		TT_AUTO_SUBFRAME = 3,
		TT_MANUAL_SUBFRAME = 4,
		TT_FORM_SUBMIT = 7,
		TT_RELOAD = 8,
		TT_SOURCE_MASK = 0xFF,
		TT_BLOCKED_FLAG = 0x00800000,
		TT_FORWARD_BACK_FLAG = 0x01000000,
		TT_CHAIN_START_FLAG = 0x10000000,
		TT_CHAIN_END_FLAG = 0x20000000,
		TT_CLIENT_REDIRECT_FLAG = 0x40000000,
		TT_SERVER_REDIRECT_FLAG = 0x80000000,
		TT_IS_REDIRECT_MASK = 0xC0000000,
		TT_QUALIFIER_MASK = 0xFFFFFF00,
	} NAV_TRANSITION_TYPE;

	typedef enum EDIT_COMMANDS
	{
		EDIT_CMD_BACKCOLOR,
		EDIT_CMD_BOLD,
		EDIT_CMD_CONTENTREADONLY,
		EDIT_CMD_COPY,
		EDIT_CMD_CREATELINK,
		EDIT_CMD_CUT,
		EDIT_CMD_DECREASEFONTSIZE,
		EDIT_CMD_DELETE,
		EDIT_CMD_ENABLEINLINETABLEEDITING,
		EDIT_CMD_ENABLEOBJECTRESIZING,
		EDIT_CMD_FONTNAME,
		EDIT_CMD_FONTSIZE,
		EDIT_CMD_FORECOLOR,
		EDIT_CMD_FORMATBLOCK,
		EDIT_CMD_FORWARDDELETE,
		EDIT_CMD_HEADING,
		EDIT_CMD_HILITECOLOR,
		EDIT_CMD_INCREASEFONTSIZE,
		EDIT_CMD_INDENT,
		EDIT_CMD_INSERTBRONRETURN,
		EDIT_CMD_INSERTHORIZONTALRULE,
		EDIT_CMD_INSERTHTML,
		EDIT_CMD_INSERTIMAGE,
		EDIT_CMD_INSERTORDEREDLIST,
		EDIT_CMD_INSERTUNORDEREDLIST,
		EDIT_CMD_INSERTPARAGRAPH,
		EDIT_CMD_INSERTTEXT,
		EDIT_CMD_ITALIC,
		EDIT_CMD_JUSTIFYCENTER,
		EDIT_CMD_JUSTIFYFULL,
		EDIT_CMD_JUSTIFYLEFT,
		EDIT_CMD_JUSTIFYRIGHT,
		EDIT_CMD_OUTDENT,
		EDIT_CMD_PASTE,
		EDIT_CMD_REDO,
		EDIT_CMD_REMOVEFORMAT,
		EDIT_CMD_SELECTALL,
		EDIT_CMD_STRIKETHROUGH,
		EDIT_CMD_SUBSCRIPT,
		EDIT_CMD_SUPERSCRIPT,
		EDIT_CMD_UNDERLINE,
		EDIT_CMD_UNDO,
		EDIT_CMD_UNLINK,
		EDIT_CMD_UNSELECT,
		EDIT_CMD_USECSS,
		EDIT_CMD_STYLEWITHCSS,

		// CEFX	- Table
		EDIT_CMD_TABLE_INSERT,
		EDIT_CMD_TABLE_DELETE,
		EDIT_CMD_TABLE_INSERT_ROW,
		EDIT_CMD_TABLE_INSERT_COL,
		EDIT_CMD_TABLE_REMOVE_ROW,
		EDIT_CMD_TABLE_REMOVE_COL,
		EDIT_CMD_TABLE_MERGE,
		EDIT_CMD_TABLE_SPLIT_HORIZ,
		EDIT_CMD_TABLE_SPLIT_VERT,

		// CEFX - Selection
		EDIT_CMD_SEL_GET_TYPE,
		EDIT_CMD_SEL_GET_COLLAPSED,
		EDIT_CMD_SEL_GET_CONTAINS_NODE,

		EDIT_CMD_SEL_GET_HTML,
		EDIT_CMD_SEL_SET_HTML, 
		
		EDIT_CMD_SEL_GET_TEXT,		
		EDIT_CMD_SEL_SET_TEXT,

		EDIT_CMD_SEL_GET_FONT_NAME,
		EDIT_CMD_SEL_GET_FONT_SIZE,
		EDIT_CMD_SEL_GET_FONT_COLOR,
		EDIT_CMD_SEL_GET_FONT_BACK_COLOR,
		EDIT_CMD_SEL_GET_FONT_STYLE,
		EDIT_CMD_SEL_GET_FONT_BOLD,
		EDIT_CMD_SEL_GET_FONT_ITALIC,
		EDIT_CMD_SEL_GET_FONT_UNDERLINE,
		EDIT_CMD_SEL_GET_FONT_STRIKETHROUGH,

		EDIT_CMD_SEL_SET_FONT_NAME,
		EDIT_CMD_SEL_SET_FONT_SIZE,
		EDIT_CMD_SEL_SET_FONT_COLOR,
		EDIT_CMD_SEL_SET_FONT_BACK_COLOR,		
		EDIT_CMD_SEL_SET_FONT_BOLD,
		EDIT_CMD_SEL_SET_FONT_ITALIC,
		EDIT_CMD_SEL_SET_FONT_UNDERLINE,
		EDIT_CMD_SEL_SET_FONT_STRIKETHROUGH,
		
		EDIT_CMD_SEL_COLLAPSE_TO_END,
		EDIT_CMD_SEL_COLLAPSE_TO_START,
		EDIT_CMD_SEL_DELETE,
		EDIT_CMD_SEL_EMPTY,
		EDIT_CMD_SEL_EXTEND,
		EDIT_CMD_SEL_ALL_CHILDREN,

		// CEFX Other
		EDIT_CMD_GET_URL,

	} EDIT_COMMANDS;

	[
		object,
		uuid(9B527943-9DF8-479A-8BE7-DEBF8BBD5A42),
		helpstring("mobileFX WebKitX for CEF3"),
		dual,
		nonextensible,
		pointer_default(unique)
	]
	interface ISettings : IDispatch
	{
		[propget, id(2)] HRESULT accept_language_list([out, retval] BSTR* pVal);
		[propput, id(2)] HRESULT accept_language_list([in] BSTR newVal);
		[propget, id(3)] HRESULT cache_path([out, retval] BSTR* pVal);
		[propput, id(3)] HRESULT cache_path([in] BSTR newVal);
		[propget, id(4)] HRESULT command_line_args_disabled([out, retval] LONG* pVal);
		[propput, id(4)] HRESULT command_line_args_disabled([in] LONG newVal);
		[propget, id(5)] HRESULT enable_net_security_expiration([out, retval] LONG* pVal);
		[propput, id(5)] HRESULT enable_net_security_expiration([in] LONG newVal);
		[propget, id(6)] HRESULT framework_dir_path([out, retval] BSTR* pVal);
		[propput, id(6)] HRESULT framework_dir_path([in] BSTR newVal);
		[propget, id(7)] HRESULT ignore_certificate_errors([out, retval] LONG* pVal);
		[propput, id(7)] HRESULT ignore_certificate_errors([in] LONG newVal);
		[propget, id(8)] HRESULT javascript_flags([out, retval] BSTR* pVal);
		[propput, id(8)] HRESULT javascript_flags([in] BSTR newVal);
		[propget, id(9)] HRESULT locale([out, retval] BSTR* pVal);
		[propput, id(9)] HRESULT locale([in] BSTR newVal);
		[propget, id(10)] HRESULT locales_dir_path([out, retval] BSTR* pVal);
		[propput, id(10)] HRESULT locales_dir_path([in] BSTR newVal);
		[propget, id(11)] HRESULT log_file([out, retval] BSTR* pVal);
		[propput, id(11)] HRESULT log_file([in] BSTR newVal);
		[propget, id(12)] HRESULT persist_session_cookies([out, retval] LONG* pVal);
		[propput, id(12)] HRESULT persist_session_cookies([in] LONG newVal);
		[propget, id(13)] HRESULT persist_user_preferences([out, retval] LONG* pVal);
		[propput, id(13)] HRESULT persist_user_preferences([in] LONG newVal);
		[propget, id(14)] HRESULT remote_debugging_port([out, retval] LONG* pVal);
		[propput, id(14)] HRESULT remote_debugging_port([in] LONG newVal);
		[propget, id(15)] HRESULT resources_dir_path([out, retval] BSTR* pVal);
		[propput, id(15)] HRESULT resources_dir_path([in] BSTR newVal);
		[propget, id(16)] HRESULT uncaught_exception_stack_size([out, retval] LONG* pVal);
		[propput, id(16)] HRESULT uncaught_exception_stack_size([in] LONG newVal);
		[propget, id(17)] HRESULT user_agent([out, retval] BSTR* pVal);
		[propput, id(17)] HRESULT user_agent([in] BSTR newVal);
		[propget, id(18)] HRESULT user_data_path([out, retval] BSTR* pVal);
		[propput, id(18)] HRESULT user_data_path([in] BSTR newVal);
		[propget, id(19)] HRESULT application_cache([out, retval] BSTR* pVal);
		[propput, id(19)] HRESULT application_cache([in] BSTR newVal);
		[propget, id(20)] HRESULT cursive_font_family([out, retval] BSTR* pVal);
		[propput, id(20)] HRESULT cursive_font_family([in] BSTR newVal);
		[propget, id(21)] HRESULT background_color([out, retval] OLE_COLOR* pVal);
		[propput, id(21)] HRESULT background_color([in] OLE_COLOR newVal);
		[propget, id(22)] HRESULT databases([out, retval] VARIANT_BOOL* pVal);
		[propput, id(22)] HRESULT databases([in] VARIANT_BOOL newVal);
		[propget, id(23)] HRESULT default_encoding([out, retval] BSTR* pVal);
		[propput, id(23)] HRESULT default_encoding([in] BSTR newVal);
		[propget, id(24)] HRESULT default_fixed_font_size([out, retval] LONG* pVal);
		[propput, id(24)] HRESULT default_fixed_font_size([in] LONG newVal);
		[propget, id(25)] HRESULT default_font_size([out, retval] LONG* pVal);
		[propput, id(25)] HRESULT default_font_size([in] LONG newVal);
		[propget, id(26)] HRESULT fantasy_font_family([out, retval] BSTR* pVal);
		[propput, id(26)] HRESULT fantasy_font_family([in] BSTR newVal);
		[propget, id(27)] HRESULT file_access_from_file_urls([out, retval] VARIANT_BOOL* pVal);
		[propput, id(27)] HRESULT file_access_from_file_urls([in] VARIANT_BOOL newVal);
		[propget, id(28)] HRESULT fixed_font_family([out, retval] BSTR* pVal);
		[propput, id(28)] HRESULT fixed_font_family([in] BSTR newVal);
		[propget, id(29)] HRESULT image_loading([out, retval] VARIANT_BOOL* pVal);
		[propput, id(29)] HRESULT image_loading([in] VARIANT_BOOL newVal);
		[propget, id(30)] HRESULT image_shrink_standalone_to_fit([out, retval] VARIANT_BOOL* pVal);
		[propput, id(30)] HRESULT image_shrink_standalone_to_fit([in] VARIANT_BOOL newVal);
		[propget, id(31)] HRESULT javascript([out, retval] VARIANT_BOOL* pVal);
		[propput, id(31)] HRESULT javascript([in] VARIANT_BOOL newVal);
		[propget, id(32)] HRESULT javascript_access_clipboard([out, retval] VARIANT_BOOL* pVal);
		[propput, id(32)] HRESULT javascript_access_clipboard([in] VARIANT_BOOL newVal);
		[propget, id(33)] HRESULT local_storage([out, retval] VARIANT_BOOL* pVal);
		[propput, id(33)] HRESULT local_storage([in] VARIANT_BOOL newVal);
		[propget, id(34)] HRESULT minimum_font_size([out, retval] LONG* pVal);
		[propput, id(34)] HRESULT minimum_font_size([in] LONG newVal);
		[propget, id(35)] HRESULT minimum_logical_font_size([out, retval] LONG* pVal);
		[propput, id(35)] HRESULT minimum_logical_font_size([in] LONG newVal);
		[propget, id(36)] HRESULT plugins([out, retval] VARIANT_BOOL* pVal);
		[propput, id(36)] HRESULT plugins([in] VARIANT_BOOL newVal);
		[propget, id(37)] HRESULT remote_fonts([out, retval] VARIANT_BOOL* pVal);
		[propput, id(37)] HRESULT remote_fonts([in] VARIANT_BOOL newVal);
		[propget, id(38)] HRESULT sans_serif_font_family([out, retval] BSTR* pVal);
		[propput, id(38)] HRESULT sans_serif_font_family([in] BSTR newVal);
		[propget, id(39)] HRESULT serif_font_family([out, retval] BSTR* pVal);
		[propput, id(39)] HRESULT serif_font_family([in] BSTR newVal);
		[propget, id(40)] HRESULT standard_font_family([out, retval] BSTR* pVal);
		[propput, id(40)] HRESULT standard_font_family([in] BSTR newVal);
		[propget, id(41)] HRESULT tab_to_links([out, retval] VARIANT_BOOL* pVal);
		[propput, id(41)] HRESULT tab_to_links([in] VARIANT_BOOL newVal);
		[propget, id(42)] HRESULT text_area_resize([out, retval] VARIANT_BOOL* pVal);
		[propput, id(42)] HRESULT text_area_resize([in] VARIANT_BOOL newVal);
		[propget, id(43)] HRESULT universal_access_from_file_urls([out, retval] VARIANT_BOOL* pVal);
		[propput, id(43)] HRESULT universal_access_from_file_urls([in] VARIANT_BOOL newVal);
		[propget, id(44)] HRESULT web_security([out, retval] VARIANT_BOOL* pVal);
		[propput, id(44)] HRESULT web_security([in] VARIANT_BOOL newVal);
		[propget, id(45)] HRESULT webgl([out, retval] VARIANT_BOOL* pVal);
		[propput, id(45)] HRESULT webgl([in] VARIANT_BOOL newVal);
		[propget, id(46)] HRESULT javascript_close_windows([out, retval] VARIANT_BOOL* pVal);
		[propput, id(46)] HRESULT javascript_close_windows([in] VARIANT_BOOL newVal);
		[propget, id(47)] HRESULT javascript_dom_paste([out, retval] VARIANT_BOOL* pVal);
		[propput, id(47)] HRESULT javascript_dom_paste([in] VARIANT_BOOL newVal);
		[propget, id(48)] HRESULT flash_player_dll_path([out, retval] BSTR* pVal);
		[propput, id(48)] HRESULT flash_player_dll_path([in] BSTR newVal);

		[id(255)] HRESULT toString([out, retval] BSTR* str);
	};


	[ 
		uuid(0A76D3F3-A67A-4267-AB1C-884DD2CAF047)	
	]
	dispinterface _DWebKitXCEF3
	{
		properties:

			// IPC

			[id(100)] LONG IPC_TIMEOUT_MILLIS;
			
			// HTML5 Editing
						
			[id(9)] VARIANT_BOOL Modified;

			// DOM Events

			[id(15)] DOM_EVENTS Events;
			[id(106)] VARIANT_BOOL ASYNC_EVENTS;
			[id(107)] VARIANT_BOOL FireOnEventForAllEvents;

			// Navigation
			
			[id(80)] VARIANT_BOOL BrowserReady; 
			[id(10)] BSTR HTML;
			[id(64)] BSTR URL;
			[id(77)] BSTR BaseURL;
			[id(76)] BSTR CurrentURL;

			[id(16)] OLE_HANDLE hWnd;
			[id(17)] OLE_HANDLE hWndBrowser;

			// HTML5 Editing - Selection
			
			[id(20)] BSTR ActiveElement;			
			[id(25)] BSTR SelAnchorElement;
			[id(26)] BSTR SelFocusElement;

			[id(32)] BSTR SelHTML;
			[id(33)] BSTR SelFontName;
			[id(34)] BSTR SelFontSize;
			[id(35)] BSTR SelFontColor;
			[id(36)] BSTR SelFontBackColor;			
			[id(38)] BSTR SelText;
			[id(39)] BSTR SelType;

			[id(40)] VARIANT_BOOL SelCollapsed;
			[id(49)] VARIANT_BOOL SelFontBold;
			[id(50)] VARIANT_BOOL SelFontItalic;
			[id(51)] VARIANT_BOOL SelStrikeThrough;
			[id(52)] VARIANT_BOOL SelFontUnderline;
			[id(54)] VARIANT_BOOL ExecCommandSetFocus;
			[id(55)] VARIANT_BOOL SpellChecking;

			[id(56)] VARIANT_BOOL FormatUsingInternalSelectionAPI;

			// Data-Binding (WIP)
			
			[id(71)] BSTR DataSource;
			[id(72)] BSTR DataMember;			
			[id(95)] BSTR DataField;

			// HTML5 Editing - Undo / Redo

			[id(96)] VARIANT_BOOL UndoEnabled;
			[id(85)] LONG UndoSize;
			[id(87)] VARIANT_BOOL CanUndo;
			[id(88)] VARIANT_BOOL CanRedo;
			[id(89)] LONG RedoSize;
			[id(90)] VARIANT_BOOL UndoObserverEnabled;

			// Download Files
			
			[id(91)] VARIANT_BOOL DownloadScripts;			

		methods:

			// Creation / Activation

			[id(79)] void Create();
			[id(81)] void Repaint();
			[id(31)] VARIANT_BOOL Activate(BSTR YourEmail, BSTR YourActivationKey);
			[id(108)] VARIANT_BOOL ActivateTerminal(BSTR YourTerminalActivationKey);

			// Chrome Dev Tools
			[id(99)] void ShowDevTools();

			// Preferences

			[id(69)] BSTR GetPreference(BSTR Name);
			[id(70)] void SetPreference(BSTR Name, BSTR Value);

			// Navigation

			[id(1)] void Open(BSTR URL); 
			[id(92)] void NavigateBack();
			[id(93)] void NavigateForward();
			[id(94)] void StopLoading();

			// JavaScript (Editor Edition Only)

			[id(97)] void AddScript(BSTR URL);
			[id(98)] void AddCode(BSTR JavaScript);
			[id(4)] BSTR Eval(BSTR Code);			
			[id(103)] VARIANT JSCallback(BSTR FunctionName, VARIANT Arguments, VARIANT_BOOL Async);
			[id(105)] VARIANT CallByName(BSTR Name, VARIANT Arguments);

			// DOM Events
			
			[id(5)] void AddEventListener(BSTR Selector, BSTR Event, LONG AddressOfEventHandler, VARIANT_BOOL UseCapture, VARIANT_BOOL Async);
			[id(6)] void AddEventListenerEx(BSTR Selector, BSTR Event, IDispatch* vbObject, BSTR vbObjectFunctionName, VARIANT_BOOL UseCapture, VARIANT_BOOL Async);			
			[id(18)] void RemoveEventListener(BSTR Selector, BSTR Event, LONG AddressOfEventHandler, VARIANT_BOOL UseCapture);
			[id(19)] void RemoveEventListenerEx(BSTR Selector, BSTR Event, IDispatch* vbObject, BSTR vbObjectFunctionName, VARIANT_BOOL UseCapture);
			[id(104)] VARIANT DispatchEvent(BSTR TargetSelector, BSTR EventName, VARIANT_BOOL Bubbles, VARIANT_BOOL Cancelable, VARIANT_BOOL Composed, VARIANT Detail, VARIANT_BOOL Async);

			// DOM Access - Attributes

			[id(59)] BSTR GetAttributes(BSTR Selector);
			[id(60)] void SetAttributes(BSTR Selector, BSTR Attributes);
			[id(74)] void RemoveAttribute(BSTR Selector, BSTR AttrName);
			[id(11)] void SetAttribute(BSTR Selector, BSTR Name, BSTR Value);
			[id(13)] BSTR GetAttribute(BSTR Selector, BSTR AttrName);

			// DOM Access - CSS3 / Styles

			[id(58)] BSTR GetStyle(BSTR Selector, BSTR Setting, VARIANT_BOOL ComputedStyle);
			[id(8)] void SetStyle(BSTR Selector, BSTR Setting, BSTR Value);
			[id(14)] BSTR GetCssText(BSTR Selector, VARIANT_BOOL ComputedStyle);
			[id(57)] void SetCssText(BSTR Selector, BSTR CSSText);

			// DOM Access - HTML Markup

			[id(21)] BSTR GetInnerHTML(BSTR Selector);
			[id(22)] void SetInnerHTML(BSTR Selector, BSTR HTML);
			[id(23)] BSTR GetOuterHTML(BSTR Selector);
			[id(24)] void SetOuterHTML(BSTR Selector, BSTR HTML);

			// HTML5 Editing

			[id(2)] void Edit();
			[id(3)] void Preview();
			[id(27)] BSTR ExecCommand(EDIT_COMMANDS Command, BSTR Selector, BSTR Arguments);
			[id(28)] BSTR TidyHTML(BSTR HTML, BSTR Options);
			[id(63)] void ReplaceText(BSTR Find, BSTR Replace, VARIANT_BOOL IgnoreCase);

			// HTML5 Editing - Selection

			[id(7)] void SelectElement(BSTR Selector, VARIANT_BOOL MoveCaret, VARIANT_BOOL SelectContents);
			[id(53)] void Deselect();
			[id(42)] void SelCollapseToEnd();
			[id(43)] void SelCollapseToStart();
			[id(44)] VARIANT_BOOL SelContainsNode(BSTR Selector, VARIANT_BOOL PartialContainment);
			[id(45)] void SelDelete();
			[id(46)] void SelEmpty();
			[id(47)] void SelExtend(BSTR Selector, LONG Offset);
			[id(48)] void SelAllChildren();
			[id(75)] void SelectTableColumn(BSTR TDSelector);
			[id(67)] void Delete(BSTR Selector);
			[id(66)] void SetSelection(LONG Offset, LONG Length);			
			[id(68)] void GetSelection(BSTR Selector, LONG* Offset, LONG* Length);

			// HTML5 Editing - Undo / Redo

			[id(83)] LONG Undo();
			[id(84)] void ClearUndo();
			[id(86)] LONG Redo();
			[id(82)] LONG Commit();

			// Download Files

			[id(101)] void CancelDownload(LONG ID);
			[id(102)] void Download(BSTR URL);			

			// Printing / Saving

			[id(65)] void Print();
			[id(78)] void SaveHTML(BSTR FileName);
			[id(109)] void SavePDF(BSTR FileName, VARIANT_BOOL Landscape);

			// Data-Binding (WIP)

			[id(73)] void DataBind(BSTR Selector);			
          };

	//  Event dispatch interface for CWebKitXCEF3Ctrl

	[ 
		uuid(745E887A-EF5D-4F67-A211-AFA70BDA4A9E)	
	]
	dispinterface _DWebKitXCEF3Events
	{
		properties:
			//  Event interface has no properties

		methods:
			[id(1)] void OnBrowserReady();
			[id(2)] void OnLoadStart();
			[id(3)] void OnLoadEnd();
			[id(4)] void OnLoadError(LONG ErrorCode, BSTR ErrorMessage, BSTR FailedURL);
			[id(5)] void OnLoadingStateChange(VARIANT_BOOL IsLoading, VARIANT_BOOL CanGoBack, VARIANT_BOOL CanGoForward);
			[id(6)] void OnAddressChange(BSTR URL);
			[id(7)] void OnTitleChange(BSTR Title);
			[id(8)] void OnStatusChange(BSTR StatusText);
			[id(9)] void OnConsoleMessage(BSTR ConsoleMessage, BSTR Source, LONG Line);			
			[id(10)] void OnTooltip(BSTR Tip);
			[id(11)] void OnFullscreenModeChange(BSTR Mode);			
			[id(13)] void OnDeselect();						
			[id(15)] void OnUndo(BSTR HTML);
			[id(16)] void OnRedo(BSTR HTML);						
			[id(17)] void OnUndoSave();
			[id(18)] void OnScriptResourceCancelled(BSTR URL);
			[id(19)] void OnContextMenu();			
			[id(20)] void OnComPostMessage(VARIANT* Params);						
			[id(21)] void OnCreate(ISettings* Settings, BSTR* CommandLineSwitches);
			[id(22)] void OnIPCTimeOut();
			[id(23)] void OnBeforeDownload(LONG ID, BSTR URL, BSTR OriginalUrl, BSTR MimeType, BSTR* FullPath, BSTR* SuggestedFileName, LONG TotalBytes, LONG ReceivedBytes, LONG PercentComplete, LONG CurrentSpeed, VARIANT_BOOL* Cancel);
			[id(24)] void OnDownloadUpdated(LONG ID, BSTR URL, BSTR OriginalUrl, BSTR MimeType, BSTR FullPath, BSTR SuggestedFileName, LONG TotalBytes, LONG ReceivedBytes, LONG PercentComplete, LONG CurrentSpeed, VARIANT_BOOL* Cancel);			
			[id(25)] void OnBeforeNavigate(LONG ID, LONG BrowserID, LONG FrameID, BSTR FrameName, VARIANT_BOOL IsRedirect, NAV_RESOURCE_TYPE ResourceType, NAV_TRANSITION_TYPE TransitionType, BSTR Method, BSTR ReferrerURL, BSTR CurrentURL, BSTR* NewURL, VARIANT_BOOL* Cancel);			
			[id(12)] void OnEvent(BSTR EventType, BSTR EventSelector, BSTR TargetSelector, BSTR TargetPath, BSTR EventData, VARIANT_BOOL Async, VARIANT_BOOL* PreventDefault, VARIANT_BOOL* CancelBubble);
	};

	//  Class information for CWebKitXCEF3Ctrl
	[
		uuid(DFF43867-EAC5-4170-96B0-265A91723BCA)
	]
	coclass WebKitXCEF3
	{
		[default] dispinterface _DWebKitXCEF3;
		[default, source] dispinterface _DWebKitXCEF3Events;
	};

	[
		uuid(9CC49284-7BCE-4BB1-9FE9-A8CFC1029CD2)		
	]
	coclass Settings
	{
		[default] interface ISettings;
	};
		
};

WebKitX SamplesWebKitX HTML5 Editor (VB6)

This is a simple, yet complete, sample of WebKitX CEF3 ActiveX control. The sample is shipped both as Visual Basic 6 source code project, as well as a complete binary bundle that includes CodeMax Editor ActiveX and CEF3 binaries. The sample demonstrates all WebKitX advanced features including FrontPage-like selection synchronization between HTML5 Designer and Source Editor, Table Editing, Selector API, and advanced CSS3 styling. The binary bundle can be used as a royalties-free stand-alone HTML5 Editor.





Simple Browser (VB6)

This sample demonstrates the WebKitX Browser Edition (no editing possible). You can embed WebKitX in your applications with just 3 lines of code!

History

On December 2014 mobileFX open sourced on GitHub WebKitX based on CEF1: Chromium Embedded Framework (CEF1) ActiveX Wrapper (Dec 2014). Since then we received tons of requests (and bounties) from Visual Basic 6 programmers for a CEF3 version of our ActiveX. Since CEF1 and CEF3 have completely different architectures, we decided to write the new ActiveX from scratch. At the same time we wanted CEF3 WebKitX to be suitable for commercial products and HTML5 Editors (such as Coconut2D) and designed several innovative features for it. 

On December 2017 we decided to finally implement the CEF3 version of WebKitX as an affordable commercial solution, with proper support. WebKitX for CEF3 has quite some unique innovations on it, such as the back-to-back COM-to-IPC bus implementation, care for multithreading and our own HTML5 editing and selection engine that we will keep evolving.

Other mobileFX Products


CairoCanvasX is an HTML5 Canvas 2D Rendering Context for use with OLE/COM languages that does not require HTML5 run-time. The ActiveX is linked with Cairo 2D Graphics Library version 1.10.2 from GTK+ 2.24 win32 implementation. This is a production-grade stable component for commercial use that will add hardware accelerated vector graphics in your desktop applications and 2D games. Effort has been made to preserve HTML5 canvas API in order to offer smooth web to desktop porting and vice versa.

Find out more about CairoCanvasX