Click here to Skip to main content
13,864,419 members
Click here to Skip to main content
Add your own
alternative version

Stats

319K views
1K downloads
51 bookmarked
Posted 26 Aug 2001
Licenced CPOL

HTML based dialog for the Pocket PC

, 26 Aug 2001
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

You may also be interested in...

Comments and Discussions

 
GeneralRe: How do I control page?.. Pin
Benny1258-Jun-04 18:59
memberBenny1258-Jun-04 18:59 
GeneralRe: How do I control page?.. Pin
Boonchai M9-Nov-04 0:56
memberBoonchai M9-Nov-04 0:56 
GeneralRe: How do I control page?.. Pin
ProudPrimate7-Mar-10 16:58
memberProudPrimate7-Mar-10 16:58 
QuestionHow to Handle Forms? Pin
jemodurn17-Apr-03 22:43
memberjemodurn17-Apr-03 22:43 
AnswerRe: How to Handle Forms? Pin
jswolf1923-Jul-03 11:32
memberjswolf1923-Jul-03 11:32 
GeneralHow to Handle Forms? [modified] Pin
bipdan26-Feb-07 0:08
memberbipdan26-Feb-07 0:08 
GeneralCompilation Errors Pin
mrabie12-Mar-03 11:32
membermrabie12-Mar-03 11:32 
GeneralRe: Compilation Errors Pin
keith woodward16-Mar-03 12:59
memberkeith woodward16-Mar-03 12:59 
GeneralRe: Compilation Errors Pin
freddy1ca9-Oct-04 16:25
memberfreddy1ca9-Oct-04 16:25 
GeneralRe: Compilation Errors Pin
handdol7-Apr-03 22:00
memberhanddol7-Apr-03 22:00 
GeneralRe: Compilation Errors Pin
JoongHoon Lee21-May-03 22:47
memberJoongHoon Lee21-May-03 22:47 
GeneralRe: Compilation Errors Pin
slomoman11-Oct-03 5:03
memberslomoman11-Oct-03 5:03 
QuestionHow to get the word selected on HTMLviewer Pin
biswa13-Dec-02 2:20
memberbiswa13-Dec-02 2:20 
AnswerRe: How to get the word selected on HTMLviewer Pin
Anonymous16-Dec-02 2:33
memberAnonymous16-Dec-02 2:33 
GeneralRe: How to get the word selected on HTMLviewer Pin
DerTyp16-Dec-02 13:45
memberDerTyp16-Dec-02 13:45 
GeneralRe: How to get the word selected on HTMLviewer Pin
biswa5-Mar-03 20:21
memberbiswa5-Mar-03 20:21 
GeneralRe: How to get the word selected on HTMLviewer Pin
ProudPrimate7-Mar-10 13:19
memberProudPrimate7-Mar-10 13:19 
GeneralQ241750 BUG: CHtmlView Leaks Memory by Not Releasing BSTRs in Several Methods Pin
Codin' Carlos5-Oct-02 8:31
memberCodin' Carlos5-Oct-02 8:31 
QuestionLeaks in Example Code...? Pin
Codin' Carlos5-Oct-02 4:34
memberCodin' Carlos5-Oct-02 4:34 
GeneralHTML under WinCE .net 4.0 Pin
christiandubois12-Sep-02 3:42
memberchristiandubois12-Sep-02 3:42 
GeneralRe: HTML under WinCE .net 4.0 Pin
Anonymous8-Sep-03 8:57
memberAnonymous8-Sep-03 8:57 
GeneralRe: HTML under WinCE .net 4.0 Pin
radul16-Jan-04 5:45
memberradul16-Jan-04 5:45 
Generalone error Pin
GOLDEN6-Jul-02 23:43
memberGOLDEN6-Jul-02 23:43 
Generalabout HtmlView Control Pin
GOLDEN6-Jul-02 21:54
memberGOLDEN6-Jul-02 21:54 
GeneralListview class thorugh html ctrl Pin
12-Mar-02 2:02
suss12-Mar-02 2:02 

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.

Permalink | Advertise | Privacy | Cookies | Terms of Use | Mobile
Web02 | 2.8.190214.1 | Last Updated 27 Aug 2001
Article Copyright 2001 by Vassili Philippov
Everything else Copyright © CodeProject, 1999-2019
Layout: fixed | fluid