In the Inno Setup FAQ is an example of how to assign filetypes to my software. Dealing with the registry is no problem.
But how can I provide the user the choice of which filetypes he wants to assign? Let's say, I have written a simple editor for text files and want to ask if the user wants to assign .txt and/or .nfo with my program. A setup-page with checkboxes would be genius.
How to do this with Inno Setup?
Add a 'Task' to the setup, and associate each of the registry entries of your file association with this Task. Eg:
[Tasks]
Name: mypAssociation; Description: "Associate ""myp"" extension"; GroupDescription: File extensions:
[Registry]
Root: HKCR; Subkey: ".myp"; ValueType: string; ValueName: ""; ValueData: "MyProgramFile"; Flags: uninsdeletevalue; Tasks: mypAssociation
Root: HKCR; Subkey: "MyProgramFile"; ValueType: string; ValueName: ""; ValueData: "My Program File"; Flags: uninsdeletekey; Tasks: mypAssociation
...
See the documentation of 'Tasks' here.
You can find some information about file association in innosetup in a previous answer : Stackoverflow - Inno setup file association
And here, we can find an exemple in order to use this file association in .net program, just by parsing the arguments in the main method : Stackoverflow - Associate a file extension with WPF application
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With