File associations

BlitzPlus Forums/BlitzPlus Programming/File associations

If I do a clean install of Windows and then install Office, I can double click on a file called ‘kittens.doc’ and the file will be opened in Word. I haven’t myself told windows or Word what to do with a doc file - it just works.


You didn't, but Word itself did during the install.

There some info in the registry which states the application name, location, and sometimes some additional command line parameters.

In order to register your own extension automatically, you'll need to add the appropriate info to the registry yourself.

when you double-click on a file, windows will simply launch the application with the pre-defined parameters, which include the name of the file you clicked on. The program can see this info passed along as a command line parameter, through commandline$()

so... when you launch your app, have it look at commandline$() and you can find out if it received a file to load.

most of these programs will check upon startup if they are already running, and if so they'll just change the focus to the already running copy and quit themselves, rather than launching a 2nd copy. It can pass along info on loading the 2nd document through an API call to the other program.