Recently, i needed to open a desktop application i had written in REALBasic from a web page link.
To achieve this i had to somehow associate the protocol, lets call it mydesktopapplication:// with the application I wanted to run. Not only in XP, but also in OSX.
I'll tackle XP first.
Windows XP
This required a set of registry entries like so:
[-HKEY_CLASSES_ROOTmydesktopapplication]
[HKEY_CLASSES_ROOTmydesktopapplication]
@="URL:mydesktopapplication"
"URL Protocol"=""
[HKEY_CLASSES_ROOTmydesktopapplicationshell]
[HKEY_CLASSES_ROOTmydesktopapplicationshellopen]
[HKEY_CLASSES_ROOTmydesktopapplicationshellopencommand]
@=""C:PATHTOmydesktopapplication.exe" "-%1""
Create a .reg file, paste the entries in and double click on the file to add to the registry. Remember to change the path and protocol to what you want yours to be. To test, in any text editor, create a .html file and add the following html:
Open application
Clicking on the link will run the application, if not then go back and make sure that the path to your application in your .reg file is correct.
Wait! I can't make my users double click that file every time.
I know, I know.
To seamlessly add these entries to the users registry can be done through the installer. I chose to use NSIS (Nullsoft Scriptable Install System) as its easy to use, widely supported and ... free. :)
You will need to learn the NSIS syntax for adding registry entries and then enter them into your .nsis file. OR i could just paste it here...
WriteRegStr HKCR "mydesktopapplication" "" "URL:mydesktopapplication"
WriteRegStr HKCR "mydesktopapplication" "URL Protocol" ""
WriteRegStr HKCR "mydesktopapplicationshellopencommand" "" '"PATH_TOmydesktopapplication.exe" "-%1"'
This is just the beginning of what an NSIS installation script requires, I just haven't gone into it all since its not the point of this guide. There is a bucket load of information here to get you started.
MacOSX
The secret is in the inner workings of the .app bundle. When REALBasic compiles an OSX version, it creates an .app directory structure. Within this lives info.plist under the CONTENTS directory. This is an xml structure which holds information for the app.
To this file add:
CFBundleURLTypes
CFBundleURLName
Playlist Downloader
CFBundleURLSchemes
mydesktopapplication
Just before the closing tag.
At this point you will need to create a DMG file. There are many guides on how to do this.
Once you install the DMG into your applications folder the protocol is registered automatically. I encountered problems when the protocol would occasionally fail to register. The only solution was to remove the application from the APPLICATIONS folder, reboot the machine and reinstall it.
Hope this helps others. Any problems then ask.

Hello\
I have an application that i create using JAVA, but i don’t know how to create an Icon on the desktop that will run the application.
By John on March 20th, 2008