Installing File Type Icons
Previous Top Next

By default virtual registry keys do not alter the system registry in any way. Using the optional "create_on_install" and "remove_on_uninstall" registry key flags, you can modify system registry keys.

One use for this is to install shell icons and open-commands during installation. The following example shows how to modify the file extension ".zip" to use your program Icon and launch your application when a .ZIP file is opened from the shell.


HKEY_CLASSES_ROOT\ .zip
create_on_install remove_on_uninstall
{
value "" 01 " zipfile
"
}

HKEY_CLASSES_ROOT\ zipfile
create_on_install remove_on_uninstall
{
value "" 01 " Zip File
"
subkey DefaultIcon
{
value "" 01 "%InstallPath%\%ProgramName%"
}
subkey shell
{
subkey open
{
subkey command
{
value "" 01 "%InstallPath%\%ProgramName% #251"
}
}
}
}



Specifying an Alternate Icon for your document types

%InstallPath%\%ProgramName% will expand to the full path of your Installed EXE.
If your EXE has multiple Icons, you can specify an alternate Icon to be displayed for a different file type by using a DefaultIcon value something like this:

value "" 01 "%InstallPath%\%ProgramName%, -201
"

Where 201 is the Icon Id inside your EXE which you are referring to.


Specifying an Alternate command to open your documents

The value of the subkey "command" controls what command is executed when the user clicks on your document.
The default command listed above expands to:


"%InstallPath%\%ProgramName% #251"

because #25 is hex for the ASCII character '%', this expands to:

"c:\program files\myprogram\myprogram.exe %1"


And %1 is expanded by Windows to the name of the document the user has clicked on.
So, your application will be run with one command line argument which is the name of the file.
If you don't want more than one instance of your application open, you may wish to send a message to the first running copy of your application and shutdown the second copy. For more details on how to implement this, see this page. How to implement mutli-instance message passing in Thinstall.