Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Inno Setup Optional (user-selectable) file association

Tags:

inno-setup

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?

like image 475
0xDEADBEEF Avatar asked Jan 18 '12 11:01

0xDEADBEEF


2 Answers

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.

like image 200
Sertac Akyuz Avatar answered Nov 17 '22 20:11

Sertac Akyuz


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

like image 1
v20100v Avatar answered Nov 17 '22 20:11

v20100v