0xDEADBEEF
0xDEADBEEF

Reputation: 3431

Inno Setup Optional (user-selectable) file association

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?

Upvotes: 14

Views: 6480

Answers (3)

v20100v
v20100v

Reputation: 714

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

Upvotes: 1

Pavel Vladov
Pavel Vladov

Reputation: 4827

Using the [Tasks] section is the easiest way to associate files with your application in Inno Setup as @Sertac has said. You should then fill in the details for the extension you want to associate in the [Registry] section. For more info about this check out the Inno Setup FAQ page.

Upvotes: 0

Sertac Akyuz
Sertac Akyuz

Reputation: 54802

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.

Upvotes: 20

Related Questions