Click here to Skip to main content
Click here to Skip to main content

HTML based dialog for the Pocket PC

, 26 Aug 2001 CPOL
Rate this:
Please Sign up or sign in to vote.
A library that provides an easy wrapper that encapsulates most of work done with the HtmlView control in CE

Screenshot

Introduction

It seems to be a good idea to use a HTML based dialog in Pocket PC applications. Much of the work you have to do will be done by HTML engine. Pocket PC provides htmlview.dll that contains the HtmlView control. But a lot of developers find it difficult to use. The STHtmlDialog library provides an easy way to use a wrapper that encapsulates most of work done with the HtmlView control.

Using HTML in dialogs your can display a text using different fonts, colors and styles, use different HTML controls, display images, use links and many other features provided by HTML.

Keep also in mind that HTML provided by HtmlView control does not support some of the features you might expect as JavaScript, frames, etc.

What You Need

Background

To create a HtmlView control without the STHtmlDialog library you should:

  1. Add htmlview.lib library to your project. Call Project Settings dialog (Alt+F7), then go to the Link tab page and add htmlview.lib string to Object/library modules field.
  2. Include Htmlctrl.h files. Add  #include <Htmlctrl.h>  line to your StdAfx.h file.
  3. Load the HTML Viewer DLL by calling the LoadLibrary function. Specify Htmlview.dll in the lpLibFileName parameter.
  4. Register the HTML Viewer control class by calling the InitHTMLControl function.
  5. Create a window for the HTML Viewer control by calling the CreateWindow function. Specify DISPLAYNAME in the lpClassName parameter
  6. Rewrite WindowProc function and handle WM_NOTIFY messages. Here you should give images and handle links (NM_HOTSPOT and NM_INLINE_IMAGE codes).

Using STHtmlDialog library

To create an HTML dialog using the STHtmlDialog library you should:

  1. Insert the STHtmlDialog.h and STHtmlDialog.cpp files into your project (use Project\Add To Project\Files menu item).
  2. Add the htmlview.lib library to your project. Call Project Settings dialog (Alt+F7), then go to the Link tab page and add htmlview.lib string to Object/library modules field.
  3. Change the super class of your dialog form CDialog to CSTHtmlDialog.
  4. In the OnInitDialog method of your dialog you should add a call to the SetHtml function that sets the HTML text.

Handling HTML events

Links

When a user clicks a link in HTML, the OnLink virtual function of your dialog is called. To handle links you should override this function. The strHref parameter contains the href attribute of the link that was clicked.

Images

To use images in HTML first register them. Call the RegisterHtmlImage function during initialization for each image you are going to use in HTML. When you register an image you should specify a string that can be used in the HTML src attribute of img tag.

Conclusion

It's easy to create an HTML based dialog using STHtmlDialog library. CSTHtmlDialog wraps functionality of HtmlView control including images and links.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

Vassili Philippov

Russian Federation Russian Federation
No Biography provided

Comments and Discussions

 
Questionhelp me Pinmemberdongjieabc26-Sep-11 18:34 
QuestionI Cann't Get WM_NOTIFY message Pinmemberdongjieabc18-Sep-11 22:33 
QuestionHTML scroll event PinmemberTrurl281217-Jul-09 4:27 
AnswerRe: HTML scroll event PinmemberSinisa Hajnal14-Mar-11 22:20 
QuestionThe content cannot display on the dialog? Pinmembertitan3154-Feb-09 22:54 
AnswerRe: The content cannot display on the dialog? PinmemberRaNo9922-Mar-09 4:28 
QuestionHow to show animation GIF ? Pinmemberkingdomkao2-Jul-08 0:10 
GeneralCompiling errors PinmemberAlexander Bonko19-Sep-07 21:36 
QuestionCan the HtmlView be embedded into other window Pinmemberorange525726-Aug-07 21:28 
QuestionWhat are HtmlWnd.[cpp|h] for? Pinmemberl_d_allan18-Aug-07 9:44 
Generalthere are 2 problems PinmemberBysakura20-Sep-06 0:06 
GeneralError with 'LPINLINEIMAGEINFO' Pinmember123snowsnow15-Mar-06 0:19 
GeneralRe: Error with 'LPINLINEIMAGEINFO' Pinmemberlininking74101720-Jun-06 20:33 
QuestionIs it possible working on the other platform? PinmemberDesperado.shlee20-Sep-05 21:15 
QuestionHow to read out Edit-fields or Option-buttons? Pinmemberderhexer22-Jul-05 5:19 
GeneralWin CE 4.2 Problem Pinmemberzikje31-May-05 4:26 
QuestionConflict with PocketIE? Pinmemberkesen9-Mar-05 23:00 
QuestionHow to COPY from HTMLView? PinmemberSvilen3337-Feb-05 1:00 
AnswerRe: How to COPY from HTMLView? PinmemberProudPrimate7-Mar-10 11:55 
GeneralLPINLINEIMAGEINFO not found Pinmemberriki_risnandar23-Jan-05 7:02 
GeneralHTML Control: probleme of memory Pinmembernoisette23-Aug-04 22:52 
QuestionHow to navigate? Pinmemberwqter25-Jul-04 5:33 
AnswerRe: How to navigate? PinmemberYongki C. A. Jong7-Nov-04 15:52 
QuestionHow to Navigate? Pinmemberwqter25-Jul-04 5:30 
GeneralHelp -- large load times PinmemberBenny12528-Jun-04 6:36 
GeneralBitmap not shown under W2003 Pinmemberthollsten5-Feb-04 9:27 
GeneralRe: Bitmap not shown under W2003 Pinmemberkaubeu26-Jul-04 23:25 
GeneralRe: Bitmap not shown under W2003 Pinmembernabilssorial9-Jan-05 3:12 
GeneralRe: Bitmap not shown under W2003 Pinmemberkaubeu9-Jan-05 11:00 
GeneralRe: Bitmap not shown under W2003 Pinmembernabilssorial9-Jan-05 23:07 
GeneralRe: Bitmap not shown under W2003 Pinmemberriki_risnandar23-Jan-05 7:38 
GeneralRe: Bitmap not shown under W2003 Pinmembernabilssorial30-Jan-05 23:31 
GeneralRe: Bitmap not shown under W2003 Pinmemberriki_risnandar31-Jan-05 17:47 
GeneralRe: Bitmap not shown under W2003 Pinmembernabilssorial2-Feb-05 5:55 
GeneralRe: Bitmap not shown under W2003 Pinmemberxingzz7-Mar-06 2:30 
GeneralRe: Bitmap not shown under W2003 Pinmemberjmt63417-Mar-10 19:00 
GeneralHTML content is not diplayed. Pinmemberbiswa10-Dec-03 22:28 
QuestionHow to Remove the cache from HTML control? Pinmemberjammu13-Nov-03 16:12 
GeneralHTML Viewer with .NET CF Pinmemberdragomir26-Oct-03 23:52 
GeneralRe: HTML Viewer with .NET CF PinsussAnonymous24-May-04 10:55 
QuestionHow to get the redirected URL or Curent URL from the HTML Viwer/Container PinmemberAKSIVAKUMAR14-Oct-03 6:35 
Questionshow HTML form WWW? Pinmemberslomoman12-Oct-03 6:42 
Generalread image from file Pinmemberslomoman11-Oct-03 5:17 
GeneralRe: read image from file PinmemberJoão Paulo Figueira11-Oct-03 7:21 
GeneralRe: read image from file Pinmemberslomoman12-Oct-03 5:53 
GeneralRe: read image from file Pinmemberyamusf8-Apr-04 4:25 
GeneralRe: read image from file Pinmemberslomoman8-Apr-04 11:16 
QuestionHow do I control page?.. PinmemberLee C.H.6-Jul-03 21:32 
AnswerRe: How do I control page?.. PinsussAnonymous11-Jul-03 22:21 
GeneralRe: How do I control page?.. Pinmemberbobhwang13-Apr-04 1:46 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Terms of Use | Mobile
Web03 | 2.8.1411023.1 | Last Updated 27 Aug 2001
Article Copyright 2001 by Vassili Philippov
Everything else Copyright © CodeProject, 1999-2014
Layout: fixed | fluid