HTMLRes is a simple command line application that creates 32 bit
binary resource files that contain HTML files suitable for displaying using
Internet Explorer’s res://
protocol. For details on how to use
the protocol see
this article.
The application simply takes a list of HTML and related support files and embeds the files a RT_HTML section of a resource file. The resource file is created from scratch. (Warning: any exisiting resource file with the same name is overwritten).
The command line syntax of the application is:
HTMLRes in-file-list [-mmanifest-file] [-oout-file] [switches]
where:
in-file-list
is a
sequence of zero or more input file names that are to be stored in the
resource filemanifest-file
is a file
containing a list of file names to be included in the resource file. Each
file name is stored on a separate line in the manifest file. Blank lines are
allowed and lines beginning with # are treated as comments and are
ignored. Comments cannot be placed on the same line as a file name.
Here’s an example file:
# Files required for demo index.html page2.html arrow.gif style.cssSpaces are not allowed between the
-m
switch and the manifest
file name.out-file
is the name of
the output resource file. This switch is optional. If the -o
switch is not provided then the default name out.res
is used.
Spaces are not allowed between the -o
switch and the output file
name.switches
is a sequence
of zero or more of:
-q
- quiet mode. Does
not display any normal output. Any error messages are
displayed.-Q
- silent mode. No
normal or error messages are displayed.-p
or -P
-
causes the program to pause, prompt the user to press return and wait for
the key to be pressed before closing the program. The prompt is always
displayed, regardless of whether the -q
or -Q
switches have been used.-H
, -h
or
-?
- displays help on using the program. The -q
and -Q
switches are ignored.At least one input file must be provided, either directly on the command line
or in the manifest file unless the -H
, -h
or
-?
switches are used.
Only the base file name is used as a resource name (i.e. path information is stripped out). Therefore each file name used must be unique, regardless of the path.
The program returns 0 on success or an explanatory error code on failure. The error codes are:
Error code | Explanation |
---|---|
1 | command line error |
2 | manifest file doesn't exist |
3 | one or more source files don't exist |
4 | duplicate resource name (file name) |
255 | unexpected / unknown error |
An example Delphi project is supplied with the program. The demo
files are installed in the Demo
folder).
The demo project simply creates a resource only DLL that stores some HTML, CSS and GIF files that can be displayed in Internet Explorer.
The demo files are:
index.html
- the main demo web page.page2.html
- a subsidiary we page.style.css
- a style sheet for the web pages.arrow.gif
- a GIF displayed in
index.html
.Demo.hmfst
- a manifest
file that lists the
demo files to be built by HTMLRes.HTMLLib.dpr
- the Delphi source code for the
resource-only DLL.Before building the demo project using Delphi you must first start a command window (DOS box) and navigate to the demo directory. Now run HTMLRes as follows:
HTMLRes -mDemo.hmfst -oHTML.res
This compiles the files specified in Demo.hmfst
into the
resource file HTML.res
.
The project file, HTMLLib.dpr
, contains a resource statement
that includes HTML.res
. The project can now be compiled with Delphi
to create the required resource DLL.
If the demo DLL is stored in the
C:\Program Files\DelphiDabbler\HTMLRes\Demo
folder we can display
the main page in Internet Explorer by entering the following URL in the address
bar:
res://C:\Program Files\DelphiDabbler\HTMLRes\Demo\HTMLLib.dll/index.html
The HTML file, its style sheet and the graphic are all stored in the DLL's resources along with a second page that can be displayed by clicking the link on the index page.
If you wish to uninstall the HTMLRes please use the Windows Control
Panel Add/Remove programs applet. A few residual files may be left behind in the
installation folder ([Program Files]\DelphiDabbler\HTMLRes
by
default where [Program Files]
is your system's default program
installation folder). These files, and the installation folder can safely be removed
manually.
This program us copyright © 2004 by Peter Johnson, Llanarth, Ceredigion,
Wales, UK. It is released under the Mozilla public license v1.1. See the file
License.txt
included with this distribution for further
details.
No warranty is provided with this program and it is used entirely at your own risk. The author cannot be held liable for any loss or damage that results from using this program.
Please notify the author if any unusual behavior is detected (see the "Feedback" section below for contact details).
Your feedback is welcome. If you have any comments, queries, bugs to report or requests for new features please contact the author via his website.