IE & DELPHI
Resource Tool ver 1.0
Create a permanent pluggable protocol.
IEDemoProtocol.dll
Source:
_iedemoprotocol.pas
iedemoprotocol.dpr
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.
To activate your protocol from the webbrowser application you don't need a
permanent protocol, but can create a temporary protocol.
IERestool offers you two different ways to make your stored webpages avaiable
for the application. Inside the executable file or in a DLL-file.
a. Store webpages inside your executable webbrowser application.
Use:
IEDemoExeProtocol.pas
IEDemo.res
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;"
//How to register the IEDemo-protocol procedure TForm1.Button1Click(Sender: TObject); begin RegisterIEDelphiProtocol; end; //How to show the page in your webbrowser procedure TForm1.Button2Click(Sender: TObject); begin embeddedwb1.go('iedelphi:page1'); end; //How to unregister the IEDemo-protocol procedure TForm1.Button3Click(Sender: TObject); begin UnRegisterIEDelphiProtocol; end; |
b. Store webpages and temporary protocol in a DLL-file.
Use:
IEDemoDLLProtocol.pas
IEDemoRes.Dll
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.
Store HTML-Resources in executabler file without protocol.
use:
IEDemo.res
If you only store HTML-dialog resources you probably not need a pluggable
protocol and you can add
{$R IEDemo.Res}
to your application and call a dialog this way:
procedure TForm1.Button1Click(Sender: TObject); begin Embeddedwb1.go('res://' + Application.Exename + '/about'); end; |
How to use
Running the demo
Creating protocols
Useful links:
The Importance of Good Dialog
How to build Dynamic HTML dialog boxes and customize them for your Web
application.
Creating HTML Dialogs in Borland Delphi
A short paper describing how to use Microsoft Internet Explorer
HTML Dialog technology with Delphi. (by David J. Fiddes).