DEVBUZZ Homepage An Open Source HTMLViewer control for eVB
 
Web www.devbuzz.com
  HOME PAGE
  All Articles
  Advertise
  Consulting

 Development
  Discuss - Forums
  Still in the box?
  .Compact Framework
  Code Snippets
  SQL Server CE
  Database
  MS Resources
 Stores
  Developer Controls
  Pocket PC Hardware
  Pocket PC Software
  Pocket PC Books
  .NET CF Books
  Book Reviews
  SPB SW Discounts
  RESCO SW Discounts
 DEVBUZZ Info
  About Us
  Help
  Join our email list
  Links & Ratings
  Press & Comments
  Pocket PC version
  Software Reviews
  Hardware Reviews
 Authors
  Authors
  Article Guide
  Competitions
 Resources
  Developers
  Register
  Login

  SPB Discounts!
 Columnists
  Rick Winscot
 Past Blast
  Personal Media Ctr
  Gizmobility
  eVB Legacy
  Old news
  Hosted Software
  Wireless
  Newsletters
  Carl Davis
  Upton Au

 Pocket PC Registry
  Join the registry
  View current list
 Current Poll
Are you converting to .NET Compact Framework?
Yes, it has changed my life!
No, I'm sticking with eVB
.NET CF what's that`?

Current results
3431 votes so far
 Recent Forum Threads [goto forums]

Get Computername
read... (67 hits)


Great aid to development productivity
read... (82 hits)


ThreadingTimer sample code
read... (143 hits)


Multithreading with .NET CF
read... (194 hits)


Moving from eMbedded Visual Basic to Visual Basic .NET
read... (166 hits)


.NET Compact Framework 2.0 Service Pack 2
read... (226 hits)


Transfer Data from SQL Server 2000 to SQL Server Compact Edition
read... (298 hits)


This protocol version is not supported
read... (236 hits)


Converting Lowercase to uppercase wont work
read... (203 hits)


Direct access to MS SQL Server 2000
read... (374 hits)


Creating SDF file in Desktop
read... (513 hits)


Winsock in CF.NET
read... (316 hits)


Using Pocket Outlook to submit HTML page form with MAILTO action
read... (420 hits)


Missing file "System.Data.PocketPC.asmmeta.dll"
read... (268 hits)


HP iPAQ hw6915 Serial Port Issue
read... (309 hits)


Info on the recent forum changes
read... (341 hits)


SqlServer tools from Redgate
read... (383 hits)


Arrow keys and Hardware navigation button
read... (393 hits)


O2 XDA lls pin sync cable to comport
read... (322 hits)


Creating dynamic folders on Pocket PC OS
read... (299 hits)

Custom Windows Mobile software development.
LBS Challenge 2007
LBS Challenge Eight previous NAVTEQ Global LBS Challenge® participants have received venture capital funding and nine past LBS Challenge winners have launched commercial applications on major wireless carriers. Register your non-commercial LBS application in the 2007 NAVTEQ Global LBS Challenge in one of three regions: Americas, Europe-Middle East-Africa (EMEA) or Asia-Pacific(APAC). You could win a share of $2 million in prizes. This could be your year.
Dream. Develop. Win.

Development | Starting Out

An Open Source HTMLViewer control for eVB
Written by Tim Wilson  [author's bio]  [read 52806 times]
Edited by Derek

Download the code   Discuss this article   eVB Ver 3.0   

Page 1  Page 2 

The Prelude

It seems that all too often designing an effective user interface for the Pocket PC turns out to be a daunting task. As a developer, I usually find myself between a rock, aesthetically pleasing the end user, and a hard place, making best use of the limited screen size. Finally, through necessity, a control was born. Dubbed the HTMLViewer, this control is essentially an ActiveX wrapper for basic HTML functionality. The HTMLViewer has allowed me to display information to the user in a much easier and creative way, rather than trying to cluster controls together and swapping frames. In other words, this control has given me more control. Before we get too much further I should point out that the HTMLViewer control outlined in this article will be distributed as Open Source.

The Capabilities and Demo App

The HTMLViewer control provides much of the necessary capabilities found in the HTML 3.2 standard. I don’t say that it supports everything related to HTML 3.2 because I can’t honestly say that I’ve tested every tag. However, all the major tags are present - pictures (gif, jpg, and bmp have been specifically tested), tables, frames, links, bookmarks, and various formatting tags. Really the only way to find out if your favorite tags are supported is to download the control and try it out.

There are two parts to the HTMLViewer:

  • A basic desktop version to allow you to draw the control onto your form at design time.
  • A Pocket PC version that contains the actual code needed to facilitate HTML capabilities on your device at run time.

Note: The reason for two separate controls stems from the differences in the operating systems and processor architectures (x86, ARM, SH3, etc.) of the desktop and Pocket PC. However, this is not as inconvenient as it sounds. Usually you can just copy over certain files from your eVC++ project to your desktop C++ project and make a few minor changes, sometimes changes aren’t even required. The first reference link at the end of this article has more on this topic.

If you choose to download the control please follow the instructions in the ReadMe file before attempting to install and use it. The download is a WinZip self-extracting file that will expand into multiple folders containing the compiled code, source code, and test pages. You must at least register the desktop version with the operating system before you can properly open the demo application in eVB. Control registration is covered in the ReadMe file. Once the desktop control has been successfully registered and included as a component in the application, the icon that appears in your toolbox should look like this:

You can place the control on the form in the usual way and resize or move it as desired. Below is a screen shot of the demo application included with this control.

The control contains two methods - LoadHTMLString, which takes a string parameter containing HTML text, and LoadHTMLFile, which takes a string parameter representing a fully qualified filename (path + filename), a bookmark, or a combination of the two (path + filename + bookmark).

You would typically use the LoadHTMLString method as follows:

Dim HTMLText As String
HTMLText = "<HTML>"
HTMLText = HTMLText & "<HEAD></HEAD>"
HTMLText = HTMLText & "<BODY>"
HTMLText = HTMLText & "<IMG SRC='\Snowman.gif'>"
HTMLText = HTMLText & "<H3>Merry Christmas</H3>"
HTMLText = HTMLText & "</BODY>"
HTMLText = HTMLText & "</HTML>"
Call HTMLViewer1.LoadHTMLString(HTMLText)

To use the LoadHTMLFile method you could do one of the following:

Call HTMLViewer1.LoadHTMLFile("\My Documents\MyFile.html")
Call HTMLViewer1.LoadHTMLFile("#MyBookmark")
Call HTMLViewer1.LoadHTMLFile("\My Documents\MyFile.html#MyBookmark")

In the demo application, the single-line textbox at the top is used to enter information sent to the ActiveX control through LoadHTMLFile, and the multi-line textbox is used to send text through LoadHTMLString. By typing the path and filename of a file into the single-line textbox and then tapping the "Load" button beside it, you can view both the contents of the file in text and HTML format.

Next Page 

Back to Starting Out | [Article Index]

 

Back to the top of the page.
Chris De Herrera's Windows CE Website Windows CE News & Information Source
Copyright ©2000-2007 by DEVBUZZ.COM, Inc., NJ. USA.MSDEVELOP