Articles   Members Online:
-Article/Tip Search
-News Group Search over 21 Million news group articles.
Member Area
-Account Center
-Top 10 NEW!!
-Submit Article/Tip
-Forums Upgraded!!
-My Articles
-Edit Information
-Become a Member
-Why sign up!
-Chat Online!
-Indexes NEW!!
-Build your resume
-Find a job
-Post a job
-Resume Search
-Link to us
Visit Embarcadero
Embarcadero Community
How to use plug-in Internet Protocols (without DLL's) Turn on/off line numbers in source code. Switch to Orginial background IDE or DSP color Comment or reply to this aritlce/tip for discussion. Bookmark this article to my favorite article(s). Print this article
Internet / Web
Delphi 2.x
User Rating
No Votes
# Votes
DSP, Administrator
Reference URL:
			 Author: Tomas Rutkauskas

Show how to make a plugin protocol which executes your program and can pass 
variables to your application (like mailto:, http:, telnet:, outlook:,...)


After searching through the internet for a way to integrate my application into 
Internet Explorer in the form of a protocol I found 2 different ways that were 
documented and included delphi code:


However I was looking for a way which would look like this:


Eventually I gave up, until I noticed that on they used this to execute a chat window 
with the desired theme. So I decided to look in the registry (as with all previous 
work I had discovered that the relevant data, usually including CLSID's would be 
linked together in the registry) and I discovered something
incredibly simple yet effective. Rather than using a DLL and CLSID's they had 
simply added some keys and values to the HKEY_CLASSES_ROOT exactly the same way as 
you would if you were associating a file-type. However there were 2 abnormal values:

HKEY_CLASSES_ROOTymsgr (Default) was equal to "URL: YMessenger Protocol"
There was a blank string added as HKEY_CLASSES_ROOTymsgr "URL Protocol"

After changing the default value I found that it made no difference, so all you 
need to do is to add a blank string named "URL Protocol".

This type of protocol can take parameters, which are parsed as follows:
Lets say that our program is named c:\program.exe and our protocol is program: if 
you use program:minimize, this is parsed asif you entered the following at the 

c:>program.exe program:minimize

therefore ParamStr(1) is equal to program:minimize

Now, if you are wondering what this has to do with myprotocol:// type protocols, 
then I think you dont quite understand what was written above. Despite the fact 
that our protocol program: does not end with //, does not mean that we can not use 
it in the same way, after all, program: does take parameters, therefore you can 
actually use myprotocol:// and simply ignore that prefix.

Heres some code to add your program as a protocol:
2   procedure AddProtocol(Details, Protocol, Command: string);
3   var
4     Reg: TRegistry;
5   begin
6     Reg := TRegistry.Create;
7     Reg.RootKey := HKEY_CLASSES_ROOT;
8     Reg.LazyWrite := false;
9     Reg.OpenKey(Protocol, true);
10    Reg.WriteString('', Details);
11    Reg.WriteString('URL Protocol', '');
12    Reg.OpenKey('shell\open\command', true);
13    Reg.WriteString('', command);
14    Reg.CloseKey;
16  end;
18  //example
20  AddProtocol('URL: DKB Protocol', 'dkb',
21    '"D:\Projects\Programs\DKB\Compiled\dkb.exe" %1');

Vote: How useful do you find this Article/Tip?
Bad Excellent
1 2 3 4 5 6 7 8 9 10


Share this page
Download from Google

Copyright © Mendozi Enterprises LLC