Click here to Skip to main content
6,596,602 members and growing! (18,556 online)
Email Password   helpLost your password?
Platforms, Frameworks & Libraries » Mobile Development » Dialogs and Windows     Intermediate

HTML based dialog for the Pocket PC

By Vassili Philippov

A library that provides an easy wrapper that encapsulates most of work done with the HtmlView control in CE
C++, eVC 3.0, Windows, Mobile, Visual Studio, MFC, Dev
Posted:26 Aug 2001
Views:190,916
Bookmarked:48 times
Announcements
Loading...
 
Search    
Advanced Search
Add to IE Search
printPrint   add Share
      Discuss Discuss   Broken Article?Report  
18 votes for this article.
Popularity: 5.92 Rating: 4.72 out of 5

1

2

3
4 votes, 28.6%
4
10 votes, 71.4%
5

Introduction

Screenshot 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 has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here

About the Author

Vassili Philippov


Member

Location: Russian Federation Russian Federation

Other popular Mobile Development articles:

  • Writing Your Own GPS Applications: Part 2
    In part two of the series, the author of "GPS.NET" teaches developers how to write GPS applications suitable for the real world by mastering GPS precision concepts. Source code includes a working NMEA interpreter and sample high-precision application in C# and VB.NET.
  • Writing Your Own GPS Applications: Part I
    What is it that GPS applications need to be good enough to use for in-car navigation? Also, how does the process of interpreting GPS data actually work? In this three-part series, I will cover both topics and give you the skills you need to write a commercial-grade GPS application.
  • Learn How to Find GPS Location on Any SmartPhone, and Then Make it Relevant
    A step by step tutorial for getting GPS from any SmartPhone, even without GPS built in, and then making location useful.
  • iPhone UI in Windows Mobile
    It's an interface that works with transparency effects. As a sample I used an interface just like the iPhone one. In this tutorial I am explaining how simple is working with transparency on Windows Mobile.
  • Pocket 1945 - A C# .NET CF Shooter
    An article on Pocket PC game development
Article Top
You must Sign In to use this message board.
FAQ FAQ 
 
Noise Tolerance  Layout  Per page   
 Msgs 1 to 25 of 100 (Total in Forum: 100) (Refresh)FirstPrevNext
QuestionHTML scroll event PinmemberTrurl28124:27 17 Jul '09  
GeneralThe content cannot display on the dialog? Pinmembertitan31522:54 4 Feb '09  
AnswerRe: The content cannot display on the dialog? PinmemberRaNo994:28 22 Mar '09  
GeneralHow to show animation GIF ? Pinmemberkingdomkao0:10 2 Jul '08  
GeneralCompiling errors PinmemberAlexander Bonko21:36 19 Sep '07  
GeneralCan the HtmlView be embedded into other window Pinmemberorange525721:28 26 Aug '07  
GeneralWhat are HtmlWnd.[cpp|h] for? Pinmemberl_d_allan9:44 18 Aug '07  
Generalthere are 2 problems PinmemberBysakura0:06 20 Sep '06  
GeneralError with 'LPINLINEIMAGEINFO' Pinmember123snowsnow0:19 15 Mar '06  
GeneralRe: Error with 'LPINLINEIMAGEINFO' Pinmemberlininking74101720:33 20 Jun '06  
QuestionIs it possible working on the other platform? PinmemberDesperado.shlee21:15 20 Sep '05  
GeneralHow to read out Edit-fields or Option-buttons? Pinmemberderhexer5:19 22 Jul '05  
GeneralWin CE 4.2 Problem Pinmemberzikje4:26 31 May '05  
GeneralConflict with PocketIE? Pinmemberkesen23:00 9 Mar '05  
GeneralHow to COPY from HTMLView? PinmemberSvilen3331:00 7 Feb '05  
GeneralLPINLINEIMAGEINFO not found Pinmemberriki_risnandar7:02 23 Jan '05  
GeneralHTML Control: probleme of memory Pinmembernoisette22:52 23 Aug '04  
GeneralHow to navigate? Pinmemberwqter5:33 25 Jul '04  
GeneralRe: How to navigate? PinmemberYongki C. A. Jong15:52 7 Nov '04  
GeneralHow to Navigate? Pinmemberwqter5:30 25 Jul '04  
GeneralHelp -- large load times PinmemberBenny1256:36 28 Jun '04  
GeneralBitmap not shown under W2003 Pinmemberthollsten9:27 5 Feb '04  
GeneralRe: Bitmap not shown under W2003 Pinmemberkaubeu23:25 26 Jul '04  
GeneralRe: Bitmap not shown under W2003 Pinmembernabilssorial3:12 9 Jan '05  
GeneralRe: Bitmap not shown under W2003 Pinmemberkaubeu11:00 9 Jan '05  

General General    News News    Question Question    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

PermaLink | Privacy | Terms of Use
Last Updated: 26 Aug 2001
Editor: Chris Maunder
Copyright 2001 by Vassili Philippov
Everything else Copyright © CodeProject, 1999-2009
Web15 | Advertise on the Code Project