|What You Need
| Windows 98 or later with IE 4 or later, Wscript, Rebol/View, and a text editor.
MSDN provides some good information about APPs, but be wary of what you read: You may come away with a misconception about what is required to achieve the most basic implementation of an APP under Windows. For example, one article implies that to write an APP one needs to implement certain interfaces, but APPs are actually very flexible. The basic implementation of an APP under Windows requires only that you make the proper entries in the registry for your protocol and that the handler for your protocol is a valid Windows .exe file. You can see an example at http://msdn.microsoft.com/library/default.asp?url=/workshop/networking/pluggable/overview/appendix_a.asp. The "note" protocol defined in that example opens Notepad, similar to the way the view-source:// protocol can be used to open the .htm source of an HTML file in Notepad. For example, try putting this in your browser: view-source:http://www.devx.com.
I doubt that Notepad implements iinternetprotocol or any related interfaces, as to do so it should be a COM implementation and found at the following registry address HKEY_CLASSES_ROOT\PROTOCOLS. Without these related interfaces, in the end all that happens is the protocol address is passed as a string via the command line to your application for analysis.
The W3C provides an incomplete list of addressing schemes, which you can use to search your system to see if these addressing schemes are implemented as APPs. Those that do more than just call over the command line should be found at the HKEY_CLASSES_ROOT\PROTOCOLS\Handler registry key.
There are many tools that allow you to dynamically load files via the command line, and pass on command lines to files. One example is script interpreters such as Wscript.exe. Here is the sample registry file, which shows how to set a simple WScript as the handler for a protocol called ws-proto.
Windows Registry Editor Version 5.00
@="\"URL: ws-proto Protocol\""
@="wscript.exe c:\\wsproto.js %1"
Here is the protocol that handles the WScript. (Both the registry file and the protocol handler are available in the code download for this articlesee left column).
To test this handler you can either make a new text file called settings.reg, copy the registry settings there, and then click to add the settings to the registry or use the settings.reg file in the code download. You should save the protocol handler code in c:\ in a file called wsproto.js. Once you've done this you can interact with the protocol in the same way you would with any other protocol. As an example, open your preferred browser and write the following: ws-proto://howdy. The result are shown in Figure 1.
|Figure 1: Howdy. As you can see the first command line argument passed on to our Wscript is everything you wrote in your address bar.|