HTML Document

Linking other embedded resources

This basic HTML document lives as a resource embedded in the program. The HTML control is able to display such documents. It can be pointed with the URL res://example-html.exe/doc.html.

The example-html.exe determines name of the module (*.exe or *.dll) where the resource lives and the rest is ID of the HTML resource in it. Note you can use both numeric and string resource IDs but string identifiers are recommended.

The document can use other resources as images or cascading style sheets as the two images on the right demonstrate. One of them is referred with absolute URL while the second one uses relative URL.

Linking remote resources

Of course it can also handle normal HTTP, HTTPS and other protocols:

Finally you can have links which are handled programatically by the application code. When you click on such link, the parent window of HTML control gets a notification MC_HN_APPLINK.

URL normalization

However note that IE sometimes changes the URL as used to navigate and how it looks in the notification. You can see on the following links to see the difference. IE can encode some special characters or add slash after the original URL.

It's recommended you avoid such "bad" URL patterns in the application URLs. Otherwise your application might need more complex URL matching in code handling the MC_HN_APPLINK notifications then simple string comparisons.

Dynamic contents

Application is able to modify contents of the HTML page with the message MC_HM_SETTAGCONTENTS.

Contents of this tag will be replaced by the example code in runtime.

JavaScript function called from C code

This HTML document provides a simple example JavaScript function which concatenates three strings. By clicking the following link, you ask the application to call it via the message MC_HM_CALLSCRIPTFUNC.