Displaying an HTML Document

Once you create an HTML Viewer control, you can use the control to display an HTML document.

    To display an HTML document

  1. Clear the current contents of the HTML Viewer control by sending it a WM_SETTEXT message.
  2. Load an HTML document and copy the document text to the control by sending the control a series of DTM_ADDTEXT messages for ASCII or DTM_ADDTEXTW messages for Unicode.
  3. Send the control a DTM_ENDOFSOURCE message when document procession is complete.
  4. Process any NM_HOTSPOT notifications that are sent by the control when a user taps a link or submits a form.
  5. For each NM_INLINE_IMAGE notification received from the control, load the image so that the HTML Viewer control will display the image-loading icon.
  6. After the image has loaded successfully, send the control a DTM_SETIMAGE message that contains the bitmap handle (HBITMAP) of the image to display.

    If the image does not load successfully, send a DTM_IMAGEFAIL message, which indicates to the control that it should display the broken-image icon.

  7. For each NM_INLINE_SOUND notification received from the control, load the sound, and then play it the number of times indicated in the dwLoopCount parameter.

Pocket Internet Explorer is an example of an application that uses the HTML Viewer control. The application Webview.exe links with the DLL that provides the HTML Viewer control, Htmlview.dll. The application provides the user interface, retrieves the data from each Uniform Resource Locator (URL), and interprets the data.

The following illustration shows how an application interacts with an HTML Viewer control.