Archived

This topic is now archived and is closed to further replies.

MainForze

How to "add" a new protocol to Internet Explorer?

Recommended Posts

Hey all, I was wondering how to "add" a protocol to Internet Explorer. Since my english sucks bigtime, I'll try to explain myself using an example. If you have mIRC installed, click irc://irc.afternet.org/gamedev to launch mIRC and connect to #gamedev on AfterNET. Now I assume (the installer of) mIRC set this up with just a (couple?) API function calls, but I have no idea what keywords to search MSDN for... [EDIT]Hmmm... Come to think of it, does this work with other browsers aswell? Please try here and post your findings [/EDIT] Any help is much appreciated! [edited by - MainForze on May 6, 2003 2:41:03 AM]

Share this post


Link to post
Share on other sites
quote:
Original post by MainForze
Now I assume (the installer of) mIRC set this up with just a (couple?) API function calls, but I have no idea what keywords to search MSDN for...


"moniker" would be a good bet, I think.

...and therefore I believe linux must be destroyed.

Share this post


Link to post
Share on other sites
It's a registry key. No API calls required.

Using your example, open up regedit and go to:
HKEY_CLASSES_ROOT\irc

and look at the values in there. The key one there is URL Protocol. The subkeys tell Windows what program handles the URL request:

shell\open\command is usually what you want to use. You can use DDE to send data to your app, or you can use the command line.
I set up a neat little google: protocol using vbscript that I can use to search google from the start -> run dialog, just by going "google: search for this"

[edited by - daerid on May 6, 2003 12:42:38 PM]

Share this post


Link to post
Share on other sites
quote:
Original post by Arild Fines
"moniker" would be a good bet, I think.

Arild, thank you for trying to help me out here. This is what I got from MSDN while searching for "moniker":
quote:
Quote from MSDN
A moniker is a COM object that identifies an object and provides services to allow other components to obtain a pointer to that object. There are two ways of viewing the use of monikers: as a moniker client, which is a component that uses a moniker to get a pointer to another object, and as a moniker provider, which is a component that supplies monikers identifying its objects to moniker clients.

COM uses monikers to connect to, and activate, objects, whether they are in the same machine or across a network. For example COM uses monikers to establish a network connection. They are also used to identify, connect to, and run OLE compound document link objects. In this case, the link source acts as the moniker provider and the container holding the link object acts as the moniker client.
Now, it could be my mistake, but I don''t see how this is going to add a protocol to IE for me... :s

Daerid, your suggestion looks like the one I need, but I''d like some more info on the keys and values I can use. Could you tell me where you dug up this info?

Thanks, MainForze


Share this post


Link to post
Share on other sites
quote:
Original post by MainForze
Arild, thank you for trying to help me out here. This is what I got from MSDN while searching for "moniker":
<snip/>
Now, it could be my mistake, but I don''t see how this is going to add a protocol to IE for me... :s


Hm, you''re right. "URL moniker" is better. Try this: http://www.google.com/search?q=url+moniker+site%3Amsdn.microsoft.com.

daerid''s suggestion looks a lot simpler, though... I''d probably rather go with that one, if it works.

...and that is why I believe linux must be destroyed.

Share this post


Link to post
Share on other sites
I can't find the link to that, but basically what you do is add a key to HKEY_CLASSES_ROOT for the protocol you want to implement.

For example, my google: protocol, I added the key: HKCR\google

Now, under that key, I added a REG_SZ value named "URL Protocol".
Then, also under that key, add another key named "shell", then under that, a key called "open", and then under that a key called "command". I then wrote a quick vbscript (You can use whatever type of executable command you want) to process the command line passed to it to launch IE and perform a google query based on whatever's passed after the "google:".

Here's a couple of screenshots:



Note that the entire URL protocol string is passed as the %1 (including the actual protocol name and colon, in this case "google:")

Good luck :D

[edited by - daerid on May 7, 2003 1:19:03 PM]

Share this post


Link to post
Share on other sites
I just realized I''ve been answering the wrong question - all you wanted is to spawn an external application when an URL is clicked. I was thinking of registering special URLs for use within IE, like MS does for it''s Help 2 system(ms-help://).

Sorry for any confusion.

...and that is why I believe linux must be destroyed.

Share this post


Link to post
Share on other sites
Also, I''d just like to point out that the URL Protocol is handled by the Shell (ShellExecute, I believe), not IE. Clicking a protocol link in IE just triggers it.

Share this post


Link to post
Share on other sites
HKEY_CLASSES_ROOT is a global registry key, and may have security restrictions on it under windows NT dervitives.

To make a file type private to a single user instead of using "HKEY_CLASSES_ROOT", use "HKEY_CURRENT_USER\software\classes" instead.

Share this post


Link to post
Share on other sites