Inno Setup File Association

Solved
MemeTech Posted messages 90 Status Member -  
MemeTech Posted messages 90 Status Member -
Hello!
I imagine this question has already been asked here, but either I can't find it, or it doesn't work in my case, or maybe I simply don't know how to program in Inno Setup...

In any case, I wonder how to associate WAV and OGG files with my music player from the installer.
How is this possible?

Thank you!

4 answers

  1. [Dal] Posted messages 6122 Registration date   Status Contributor Last intervention   1 108
     
    Hello MemeTech,

    In the Inno Setup FAQ, we find this:

    https://jrsoftware.org/isfaq.php#assoc

    Creating File Associations

    First set the [Setup] section directive "ChangesAssociations" to "yes". Then create [Registry] entries as shown below to create a file association for all users (requires administrative privileges.)

    [Registry]
    Root: HKLM; Subkey: "Software\Classes\.myp"; ValueType: string; ValueName: ""; ValueData: "MyProgramFile"; Flags: uninsdeletevalue

    ".myp" is the extension we're associating. "MyProgramFile" is the internal name for the file type as stored in the registry. Make sure you use a unique name for this so you don't inadvertently overwrite another application's registry key.

    Root: HKLM; Subkey: "Software\Classes\MyProgramFile"; ValueType: string; ValueName: ""; ValueData: "My Program File"; Flags: uninsdeletekey

    "My Program File" above is the name for the file type as shown in Explorer.

    Root: HKLM; Subkey: "Software\Classes\MyProgramFile\DefaultIcon"; ValueType: string; ValueName: ""; ValueData: "{app}\MYPROG.EXE,0"

    "DefaultIcon" is the registry key that specifies the filename containing the icon to associate with the file type. ",0" tells Explorer to use the first icon from MYPROG.EXE. (",1" would mean the second icon.)

    Root: HKLM; Subkey: "Software\Classes\MyProgramFile\shell\open\command"; ValueType: string; ValueName: ""; ValueData: """{app}\MYPROG.EXE"" ""%1"""

    "shell\open\command" is the registry key that specifies the program to execute when a file of the type is double-clicked in Explorer. The surrounding quotes are in the command line so it handles long filenames correctly.

    To create a file association for the current user instead of for all users use HKCU instead of HKLM.


    Dal
    1
  2. MemeTech Posted messages 90 Status Member 1
     
    Thank you for your quick response!
    I will check that out, I will keep you updated.
    0
  3. MemeTech Posted messages 90 Status Member 1
     
    Booooooooooooooon...

    I tried, but without much result: my registry keys seem valid (No error message during installation), but the icon of my program does not appear on my files and most importantly:
    impossible to open my files automatically!

    I must have made a crucial error... but where?

     [Registry] Root: HKLM; Subkey: "Software\Classes\.ogg"; ValueType: string; ValueName: ""; ValueData: "MPlayerFile"; Flags: uninsdeletevalue Root: HKLM; Subkey: "Software\Classes\MPlayerFile"; ValueType: string; ValueName: ""; ValueData: "MPlayer OGG File"; Flags: uninsdeletekey Root: HKLM; Subkey: "Software\Classes\MPlayerFile\DefaultIcon"; ValueType: string; ValueName: ""; ValueData: "{app}\MPlayer.exe,0" Root: HKLM; Subkey: "Software\Classes\MPlayerFile\shell\open\command"; ValueType: string; ValueName: ""; ValueData: """{app}\MPlayer.exe"" ""%1""" 


    PS: I did not forget the line ChangesAssociations=yes
    0
  4. MemeTech Posted messages 90 Status Member 1
     
    Strangely, by configuring the registry keys for just the current user, it worked...
    Well, I'm not going to try to understand it, I'm fine with that!

    Issue resolved, thank you again!
    0