Plug-in Internet Protocols (without DLL's) (Views: 100)
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 http://messenger.yahoo.com/messenger/imv 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 commandline:
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:
procedure AddProtocol(Details, Protocol, Command: string);
Reg := TRegistry.Create;
Reg.RootKey := HKEY_CLASSES_ROOT;
Reg.LazyWrite := false;
Reg.WriteString('URL Protocol', '');
AddProtocol('URL: DKB Protocol', 'dkb',
<< Back to main page