Page 1
Page 2

You can also type text directly into
the multi-line textbox and have it displayed in HTML format
by tapping "HTML" on the menubar. However, a more
convenient way of entering HTML is to build an HTML file
using a text editor like Notepad or an HTML generator like
FrontPage, copy it to your Pocket PC, and then tap "Load..."
on the menubar. This will bring up a CommonDialog box so
that you can select the file directly. I must caution you
on where to place a file if you choose to copy one to your
Pocket PC. It seems that the CommonDialog box only allows
you to select files in "\My Documents" or a subdirectory
thereof. So you may want to keep this in mind when copying
any files over to your device that you wish to open from
inside the demo application. There are some test pages included
with the demo to allow you to test more elaborate tag structures
like tables and frames. Please refer to the ReadMe file
for more on the test pages.
The HTMLViewer is not limited to displaying
HTML - it also provides JavaScript support. However, JavaScript
is not something that I have found a particular use for
in the eVB applications that I write. Therefore, I am not
going to outline the extent of JS support provided by the
HTMLViewer. Included with the demo application is an HTML
file (TestJavaScript.html) that demonstrates calling a JS
function that pops up an alert box when the user taps a
button. If you would like to incorporate JavaScript in your
application you may want to download the control and give
it a thorough test to see if it can support what you need.
The Possibilities
There are many possibilities as to
how you can use the ActiveX HTMLViewer control in your applications.
For example, you could use it for displaying information
in a report style, or you could also use it for something
as simple as displaying pictures such as gifs and jpgs that
arent supported with the built-in PictureBox control.
However, equally as interesting is how this control could
be modified to yield even greater possibilities. This section
will serve as a brief overview of what could be accomplished
with some modifications to the HTMLViewer control.
It is possible to have the control relay
any HTML form data, submitted through a POST, to
the eVB application. This would require you to create an
event inside the ActiveX control to allow the POSTed data
to be sent through the proper channels and handled inside
your eVB code via an event handler. To anyone not familiar
with ActiveX controls this may sound intimidating, but its
really not that hard. The first reference link at the end
of this article will give some explanation as to how to
do this. The only partial trick is to know that POSTed form
data is made available to you inside the ActiveX control
in basically the same way that the HREF value is received
when the user taps on a link. The help documentation has
more on this topic.
It is also possible to put Web Browser
functionality into the ActiveX control to allow you to view
and interact with web sites from inside your eVB application.
It would also be possible to connect to FTP sites as well
as use secure sockets (HTTPS). I should point out one interesting
observation. Since this control is really just wrapping
the Windows HTML Viewer control, internally the Windows
control is handling the loading of frame content. So if
you create a page containing a frame that is set to a URL,
the web site data is retrieved and rendered properly, including
pictures, and loaded into the target frame. Try opening
TestFrames.html, included in the "Test Pages"
folder, through the demo application and follow the instructions
in the main frame to see this in action.
One more intriguing possibility is that
its theoretically possible for you to handle the <OBJECT>
tag and allow for the ActiveX HTMLViewer control to become
a container for something like the flash player. Thus enabling
flash movies to be embedded into your eVB applications.
I look at the possibilities like this
- if Pocket Internet Explorer can do it, we should be able
to do it as well.
The Wrap-up on the Wrapper
I hope this article has helped you
understand how to use the ActiveX HTMLViewer control as
well as given you some ideas as to how you could use it
in your own applications. The capabilities are there to
give you more freedom in how you display information to
your end user, while best utilizing the limited screen real
estate. The possibilities are there for you to expand and
mold this control to best suite your needs.
As I alluded to in the prelude, all
source code for the ActiveX HTMLViewer is included in the
download for you to view, modify, and recompile - including
the desktop control, Pocket PC control, and demo application.
In other words, you are free to use and distribute this
control in both private and commercial applications. All
I ask is that you show the same courtesy to other developers
and post any changes that you make to the source code free
of charge. This is the basic idea behind Open Source. If
you feel that it might help other developers, contact
deVBuzz and inquire about writing an article detailing
any changes.
So I welcome you, and encourage you
to download the source and play around with the code to
turn any possibilities into capabilities.
References
A good article on how to write ActiveX
controls for Windows CE devices using the ATL (A little
bit dated, but a very good article nonetheless):
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnce21/html/atlce.asp
An article on how to create the Windows
HTML Viewer control in a C++ application (Dont confuse
this control with the ActiveX control. This HTML Viewer
control is the actual Windows control wrapped inside the
ActiveX control I talked about in this article):
http://www.microsoft.com/mobile/developer/technicalarticles/htmlviewer.asp
Previous Page