Resource Tool
When to use: Using IE & Delphi Resource Tool you can store webpages (including images, cascading stylesheets etc.) inside your application exe-file or in a separate DLL-file. You can also choose to add permanent or pluggable protocol handler, so your webpages can be called from Internet Explorer or your webbrowser using a protocolname similar to the built-in about-protocol: "iedelphi:mywebpage" where "iedelphi" is the name of your protocol and "mywebpage" the name of the stored webpage. The tool also include a WYSIWYG helper for editing and adding features to html-dialogs. How to use: Place IEResTool.exe in its own directory. First time you run IERestool you will need to tell the full path to your Delphi bin-directory, where BRCC32.EXE and DCC32.EXE are located. Next add full path to the directory where the files you want to add are located. It is important that all files to be included are placed in this directory. IEResTool don't include subdirectories. All html-files must use simple links, e.g.: <A HREF="page.htm"><IMG SRC="picture.jpg"></A> If you need IeResTool to be more flexible on this point (read files from subdirectories and resolve relative links) you can make the nessecary changes to the included source code. IEResTool first reads all files in the directory with file-ext. ".htm" or ".html". Next it includes all files called from these files. This means that you don't have to worry about extra files in the directory. If they are not needed to display the .htm or .html files, they are not included in the resource files.
You can use any letters or numbers [a..z, A..Z, 0..9] in the protocol name. However you cant use a number as the first character: abc123 = works fine IERestool check and let you know, if you enter an illegal protocol name. Protocol names are case in-sensitive. IERestool creates a new unique indetifier for each new protocol name,
but it saves protocol names you have used before and the GUID associated
with it. You can use the dropdown box to re-select protocol names. This is
important if you for instance create an updated version of a DLL with a
permanent pluggable protocol. (see more about this later). Select if you want to save source file for the created DLL-files and the temporary HTML-files. The default setting is shown above, and you should only save modified HTML-files for debugging if unexpected errors occurs. Now you are ready to go. Click "Create" button. If you store large websites inside resource files it may take several minutes for IERestool to finish the work, but in most cases it only takes few seconds. The stored webpages and/or HTMLdialog-files are shown in the listbox, and you can choose to see them in the default browser or as HTML-dialog. Before closing IEResTool you should create featurestring for the HTML dialogs in your resource file. Select the dialog files in the listbox and click "Test as HTMLDialog". a new window will open:
When the HTML dialog looks the way you want it, you click "FeatureString to Clipboard" and you can now paste it into your Delphi-code. The string may look like this: dialogHeight: 180px; dialogWidth: 405px; dialogTop: px; dialogLeft: px;' center: 1; dialoghide: 0; edge: raised; help: 0; resizable: 0; scroll: 0;' status: 0; unadorned: 0; To show the Dialog in your program you can use something like:
In this example the resources for the HTMLDialog is stored inside the exe-file and no protocol is attached. If protocol name was "iedelphi" and the protocol was activated the url would be: "iedelphi:about".
When you close IEResTool you will find a subdirectory to the directory where IERestool is located. The name of the subdirectory is the same as the name you selected for the protocol. IERerstool has created 9 files in the [ProtocolName] subdirectory: [ProtocolName]res.res If you in IERestool chose not to save source files only the following files would be created: [ProtocolName]res.res
1. Unzip all files and keep the subdirectories, so you have a subdirectory called "demo". The demo-files includes the following: coua.css (A cascading stylesheet used by the About-dialog and all webpages). hhwani.gif (An animated gif-file used by the about dialog and all webpages). About.htm (The About HTMLDialog). page1.htm
2. Start IERestool. Make sure IERestool knows where to find your Delphi\bin directory. 3. Set the files-directory to the demo-subdirectory. (Default). 4. Set protocol name to IEDemo 5. Click the Create-button. The Listbox shows the following files: about 6. Close IEResTool. The following files are created in a new subdirectory "IEDemo": iedemores.res
Create a permanent pluggable protocol.
If you want to be able to activate your protocol in Internet Explorer and not only in your webbrowser application, you need a permanent pluggable protocol. Register iedemoProtocol.dll: "regsvr32 iedemoProtocol.dll" from the command-line. You can now open Internet Explorer and show your stored webpages using <Protocolname>:<filename> e.g.: "iedemo:page1" to unregister the protocol: regsvr32 /u iedemoProtocol.dll. The source code for iedemoProtocol.dll is in _iedemoprotocol.pas and iedemoprotocol.dpr.
Create temporary pluggable protocol.
Copy IEDemoEXEprotocol.pas and IEDemo.res to your project directory. Add iedemoEXEprotocol to the uses section in your webbrowser application. You can now call two procedures: register<Protolcolname>protocol; unregister<protocolname>protocol; After registering the temporary protocol you can show the stored webpages in the browser by typing "iedemo:page1" in the addressbar. to unregister use: "UnregisterIEDemoProtocol;"
b. Store webpages and temporary protocol in a DLL-file. Use: IEDemoDLLProtocol.pas Copy IEDemoDLLprotocol.pas and IEDemoRes.DLL to your project directory. Add iedemoDLLprotocol to the uses section in your webbrowser application. You can now call two procedures: register<Protolcolname>protocol; unregister<protocolname>protocol; After registering the temporary protocol you can show the stored webpages in the browser by typing "iedemo:page1" in the addressbar. to unregister use: "UnregisterIEDemoProtocol;" Remember that you need to distribute the dll-file along with your application. I prefer using DLL-file to store webpages. The overhead is only 16 Kb
and resources in a DLL-file is much easier to upgrade from the main
application. use: IEDemo.res
{$R IEDemo.Res} to your application and call a dialog this way:
Useful links: The Importance of Good Dialog Creating HTML Dialogs in Borland Delphi
Enjoy!
Created and maintained by Last Update: October 16, 2000
|