Click here to Skip to main content
15,346,368 members
Articles / Mobile Apps
Posted 26 Aug 2001


51 bookmarked

HTML based dialog for the Pocket PC

Rate me:
Please Sign up or sign in to vote.
4.81/5 (14 votes)
26 Aug 2001CPOL2 min read
A library that provides an easy wrapper that encapsulates most of work done with the HtmlView control in CE



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


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


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.


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.


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


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


About the Author

Vassili Philippov
Russian Federation Russian Federation
No Biography provided

Comments and Discussions

Questionhelp me Pin
dongjieabc26-Sep-11 17:34
Memberdongjieabc26-Sep-11 17:34 
QuestionI Cann't Get WM_NOTIFY message Pin
dongjieabc18-Sep-11 21:33
Memberdongjieabc18-Sep-11 21:33 
QuestionHTML scroll event Pin
Trurl281217-Jul-09 3:27
MemberTrurl281217-Jul-09 3:27 
AnswerRe: HTML scroll event Pin
Sinisa Hajnal14-Mar-11 21:20
professionalSinisa Hajnal14-Mar-11 21:20 
QuestionThe content cannot display on the dialog? Pin
titan3154-Feb-09 21:54
Membertitan3154-Feb-09 21:54 
AnswerRe: The content cannot display on the dialog? Pin
RaNo9922-Mar-09 3:28
MemberRaNo9922-Mar-09 3:28 
QuestionHow to show animation GIF ? Pin
kingdomkao1-Jul-08 23:10
Memberkingdomkao1-Jul-08 23:10 
GeneralCompiling errors Pin
Alexander Bonko19-Sep-07 20:36
MemberAlexander Bonko19-Sep-07 20:36 
QuestionCan the HtmlView be embedded into other window Pin
orange525726-Aug-07 20:28
Memberorange525726-Aug-07 20:28 
QuestionWhat are HtmlWnd.[cpp|h] for? Pin
l_d_allan18-Aug-07 8:44
Memberl_d_allan18-Aug-07 8:44 
Generalthere are 2 problems Pin
Bysakura19-Sep-06 23:06
MemberBysakura19-Sep-06 23:06 
GeneralError with 'LPINLINEIMAGEINFO' Pin
123snowsnow14-Mar-06 23:19
Member123snowsnow14-Mar-06 23:19 
GeneralRe: Error with 'LPINLINEIMAGEINFO' Pin
lininking74101720-Jun-06 19:33
Memberlininking74101720-Jun-06 19:33 
QuestionIs it possible working on the other platform? Pin
20-Sep-05 20:15
suss20-Sep-05 20:15 
QuestionHow to read out Edit-fields or Option-buttons? Pin
derhexer22-Jul-05 4:19
Memberderhexer22-Jul-05 4:19 
GeneralWin CE 4.2 Problem Pin
zikje31-May-05 3:26
Memberzikje31-May-05 3:26 
QuestionConflict with PocketIE? Pin
kesen9-Mar-05 22:00
Memberkesen9-Mar-05 22:00 
QuestionHow to COPY from HTMLView? Pin
Svilen3337-Feb-05 0:00
MemberSvilen3337-Feb-05 0:00 
AnswerRe: How to COPY from HTMLView? Pin
ProudPrimate7-Mar-10 10:55
MemberProudPrimate7-Mar-10 10:55 
GeneralLPINLINEIMAGEINFO not found Pin
riki_risnandar23-Jan-05 6:02
Memberriki_risnandar23-Jan-05 6:02 
GeneralHTML Control: probleme of memory Pin
noisette23-Aug-04 21:52
Membernoisette23-Aug-04 21:52 
QuestionHow to navigate? Pin
wqter25-Jul-04 4:33
Memberwqter25-Jul-04 4:33 
AnswerRe: How to navigate? Pin
Yongki C. A. Jong7-Nov-04 14:52
MemberYongki C. A. Jong7-Nov-04 14:52 
QuestionHow to Navigate? Pin
wqter25-Jul-04 4:30
Memberwqter25-Jul-04 4:30 
GeneralHelp -- large load times Pin
Benny12528-Jun-04 5:36
MemberBenny12528-Jun-04 5:36 

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

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