Click here to Skip to main content
14,027,427 members
Click here to Skip to main content
Add your own
alternative version

Stats

319.6K 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: Bitmap not shown under W2003 Pin
nabilssorial2-Feb-05 4:55
membernabilssorial2-Feb-05 4:55 
GeneralRe: Bitmap not shown under W2003 Pin
xingzz7-Mar-06 1:30
memberxingzz7-Mar-06 1:30 
GeneralRe: Bitmap not shown under W2003 Pin
jmt63417-Mar-10 18:00
memberjmt63417-Mar-10 18:00 
GeneralHTML content is not diplayed. Pin
biswa10-Dec-03 21:28
memberbiswa10-Dec-03 21:28 
QuestionHow to Remove the cache from HTML control? Pin
jammu13-Nov-03 15:12
memberjammu13-Nov-03 15:12 
GeneralHTML Viewer with .NET CF Pin
dragomir26-Oct-03 22:52
memberdragomir26-Oct-03 22:52 
GeneralRe: HTML Viewer with .NET CF Pin
Anonymous24-May-04 9:55
memberAnonymous24-May-04 9:55 
QuestionHow to get the redirected URL or Curent URL from the HTML Viwer/Container Pin
AKSIVAKUMAR14-Oct-03 5:35
memberAKSIVAKUMAR14-Oct-03 5:35 
Dear All,

How to get the redirected URL or Curent URL from the HTML Viwer/Container ?

Suggestions are most welcome !!!

Regards,
AKS
Questionshow HTML form WWW? Pin
slomoman12-Oct-03 5:42
memberslomoman12-Oct-03 5:42 
Generalread image from file Pin
slomoman11-Oct-03 4:17
memberslomoman11-Oct-03 4:17 
GeneralRe: read image from file Pin
João Paulo Figueira11-Oct-03 6:21
professionalJoão Paulo Figueira11-Oct-03 6:21 
GeneralRe: read image from file Pin
slomoman12-Oct-03 4:53
memberslomoman12-Oct-03 4:53 
GeneralRe: read image from file Pin
yamusf8-Apr-04 3:25
memberyamusf8-Apr-04 3:25 
GeneralRe: read image from file Pin
slomoman8-Apr-04 10:16
memberslomoman8-Apr-04 10:16 
QuestionHow do I control page?.. Pin
Lee C.H.6-Jul-03 20:32
memberLee C.H.6-Jul-03 20:32 
AnswerRe: How do I control page?.. Pin
Anonymous11-Jul-03 21:21
memberAnonymous11-Jul-03 21:21 
GeneralRe: How do I control page?.. Pin
bob hwang13-Apr-04 0:46
memberbob hwang13-Apr-04 0:46 
GeneralRe: How do I control page?.. Pin
Benny1258-Jun-04 17:59
memberBenny1258-Jun-04 17:59 
GeneralRe: How do I control page?.. Pin
Boonchai M8-Nov-04 23:56
memberBoonchai M8-Nov-04 23:56 
GeneralRe: How do I control page?.. Pin
ProudPrimate7-Mar-10 15:58
memberProudPrimate7-Mar-10 15:58 
QuestionHow to Handle Forms? Pin
jemodurn17-Apr-03 21:43
memberjemodurn17-Apr-03 21:43 
AnswerRe: How to Handle Forms? Pin
jswolf1923-Jul-03 10:32
memberjswolf1923-Jul-03 10:32 
GeneralHow to Handle Forms? [modified] Pin
bipdan25-Feb-07 23:08
memberbipdan25-Feb-07 23:08 
GeneralCompilation Errors Pin
mrabie12-Mar-03 10:32
membermrabie12-Mar-03 10:32 
GeneralRe: Compilation Errors Pin
keith woodward16-Mar-03 11:59
memberkeith woodward16-Mar-03 11:59 

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
Web01 | 2.8.190419.4 | Last Updated 27 Aug 2001
Article Copyright 2001 by Vassili Philippov
Everything else Copyright © CodeProject, 1999-2019
Layout: fixed | fluid