Download the source code for this article
here
Using the WOW, HSP & EzStor Framework to "Web-enable" your Windows Applications
User Interfaces today are moving to a webpage look-and-feel. This is a growing trend that will continue for some time for the simple reason that you can't beat the ease with which you can achieve a superb looking interface with HTML. There are huge advantages that HTML in embedded webbrowser ActiveX controls can give. The rendering power of the IE webbrowser ActiveX control is unmatched for formatting text and graphics. However, programmers also know that this technique has limited use since the webbrowser control can only display "static" webpages. This was a severe limitation until now. We have developed technology that allows the generation of "dynamic" webpages - HTML that you generate on-the-fly during the execution of your program, using standard ASP to be used seamlessly by the webbrowser control.
WOW
The webbrowser control has many powerful features, but requires C++ and COM to access them (not to mention expertise). This is why we developed the Web On Windows (WOW) ActiveX control. It does everything needed to harness the power of the webbrowser control. Besides simple things like disabling the context menu (right-click) and giving you fine control over Accelerator keys and the border, it allows you to fire events from the webpage into your container application. This is vital for successful webbrowser programming, because you will definitely need to know in your application when certain HTML elements have been clicked (or otherwise manipulated). The WOW control is the first piece of the EzTools framework.
HSP
Displaying static HTML in the WOW control is OK for some situations, but the real power is in the ability to dynamically generate HTML "on the fly". This may be to display data from a relational database, a Web Service, or the local PC. HTML Scripting Pages, or HSP, is a plug-in DLL for IE. It is what is known as an "asynchronous pluggable protocol". IE uses pluggable protocols to retrieve its content. By default, IE uses the HTTP pluggable protocol to retrieve web content. HSP not only reads local content files, but also runs ASP files. It does this using the Microsoft Active Scripting technology. HSP runs either VBScript or JScript in ASP files. HSP is essentially an ASP webserver in a DLL.
You specify a pluggable protocol in the first part of the URL. For example, here is a HTTP URL:
http://www.microsoft.com
If we have an ASP page stored in a local folder named foo, you could run and display it in IE by typing this URL in the address bar:
x-hsp://c:/foo/mypage.asp
You can specify any local file that can be displayed by IE, such as HTML, Flash, ActiveX or Microsoft Office documents. HSP is the second key piece of the EzTools framework.
EzStor Content files
Any HTML presentation will consist of many ASP/HTML/graphic files. It is impractical to ship all of these files individually. That's why we created a way to pack all content files into a single file, much like a WinZip file. HSP knows how to read EzStor files, so you only need to ship two extra files to be able to use HSP in your application - the HSP DLL and your EzStor content file (also called HSP files). And your source code can be securely encrypted in the EzStor file so it is safe from being pirated (this is a great feature for Flash content protection).
To load a page stored in an EzStor (HSP) file, you specify both the HSP filename and the internal filename. For example, if your HSP file is named sample.hsp and the internal page is cust_table.asp, here is what the URL would look like:
x-hsp://c:/myfolder/sample.hsp/cust_table.asp
As you can see, HSP URLs follow the same syntax as HTTP URLs. You just append the path to the internal file to the path to the HSP file. Here's a screenshot of the real thing in the IE address bar:
One of the cool things about using HSP files is that relative hyperlinks are preserved. As web programmers know, this is very important and prevents having to code complete URL paths in every hyperlink. It also allows you to easily create a directory structure to logically group your files. For example, to keep all graphic files separately in a "graphics" folder, as shown below.
You would reference a graphic file using a relative path in an IMG tag just as you would for a regular website. For example, cust_table.asp would reference search.gif like this:
<img src="graphics/search.gif">
And so, EzStor is the 3rd and final key tool in the EzTools framework. Now we will show how to use these tools to build an application that hosts the WOW control and generates HTML dynamically for the UI presentation.
© Copyright 2003 EzTools Software