By following the examples below, it is possible to add 'Right Click' functionality, or Shell Extensions, to your ThinApp packages. In this way you can use Windows Explorer to send paths and file names as arguments to ThinApp executables before they launch.
In order to add these functions, I will be leveraging the Windows Installer deployment method. We do this because the relevant keys will need to be created physically in order for Windows Explorer to be able to use them.
To get started, first we need to verify that the ThinApp'ed application you are working with supports command line arguments. ThinApp will pass command line arguments it receives to the target of the entry point from which it is launched. Try opening a command window and testing the function you would like to add, by providing a directory or filename path, and any additional switches you might need. For example, here I am sending a path to a ThinApp'ed version of WinRAR:
WinRAR opens, and automatically is set to the folder I specified. This is useful for users of WinRAR as a shell extension, so they can simply right click on a folder and have it open directly in the application.
To add this function, we need to first backup the template.msi file that is included in ThinApp's installation folder. Make a copy of this file, and rename it, e.g. 'template.msi.backup'. Now open the original 'template.msi' in Orca, and add the following keys to the Registry table:
In this example, we use "Directory\shell\Compress with WinRAR" for the Key column because we want the option to show only for right clicks to Folders, and we want the right click menu item to read "Compress with WinRAR". Also note the quotes in the Value column, and the possibility to add additional switches (such as "/a" ect.) if needed. Finally, be sure to follow the example closely by setting the Registry columns to begin with R0000002 (ThinApp will add it's own R0000001 row), the Root value to '0' (i.e. HKEY_CLASSES_ROOT) and 'Files' in the Component column.
Rebuild your ThinApp package, and you should receive an MSI with your new keys included in the bin folder of your project. If all goes well, after installing your MSI, a right click on a Folder should now look like this in Windows:
Here are some other examples:
Right click on a file (ANY file), and add the option to View it in IrfanView:
When right clicking on an XLS Document, add an option to open it in an older version of Excel, while leaving the default registration to a physical copy of Office 2010 untouched (Note that this would also involve commenting out the Filetypes line in your ThinApp package, to avoid overwriting the XLS registration when Thinreg runs):
Note that in this case we needed to use the Program ID, "Excel.Sheet.8" for XLS.
As a final step, be sure to restore your backup of template.msi in your ThinApp installation folder before making additional packages.
As you can see, there are a lot of possibilities for this function, and by leveraging MSI technology, the registry keys we have added are also neatly uninstalled when the MSI is removed.