File association

A file association is information given to the Windows shell through the registry on how to handle a file with a specific extension when it is selected to be opened, edited, printed, etc.

Registering a File extension
To register a file extension, you need to suply the following:
 * The path to the executable
 * The program id and it's commands
 * The file extension's ProgId

AppPath
The AppPath is used to find the application when it is only given the filename. (filename.exe)

ProgId
The ProgId contains all the commands available to the application. (open, edit, print, etc.)

Registering a save file type
Here is an example of registering save file extension called .mygame-save to the game mygame.exe. var AppPath="\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\mygame.exe"; var ProgId="\Software\Classes\mygame.save"; var Class="\Software\Classes\.mygame-save"; registry_set_root(1);//Sets the root to HKEY_LOCAL_MACHINE registry_write_string_ext(AppPath,"(Default)",working_directory+"mygame.exe");

registry_write_string_ext(ProgId,"(Default)","mygame"); registry_write_string_ext(ProgId,"FriendlyTypeName","mygame"); registry_write_string_ext(ProgId+"\shell\play\command","(Default)",'"mygame.exe" "%1"');

registry_write_string_ext(Class,"(Default)","mygame.save");