registerFileAssociation icon resource number


#1

What number should we put here to use the icon that Introjucer generates on Windows with VisualStudio exporter ?


#2

I vaguely remember that it's usually 101


#3

Well it looks like it's 1 not 101, and for some reason JUCE negates whatever ID you pass to that function:

return setValue (root + fileExtension + "\\", symbolicDescription, mode)
        && setValue (key + "\\", fullDescription, mode)
        && setValue (key + "\\shell\\open\\command\\", targetExecutable.getFullPathName() + " \"%1\"", mode)
        && (iconResourceNumber == 0
              || setValue (key + "\\DefaultIcon\\",
                           targetExecutable.getFullPathName() + "," + String (-iconResourceNumber)));

And that causes an entry in the registry that looks like ((if i pass -1 as an argument to the call it works, but that's silly i think):

C:\devel\ctrlr\nightly\Builds\Generated\Windows\Standalone\.\..\..\..\..\Bin\Standalone\Win32\Ctrlr-Debug-Win32.exe,-1

instead of

C:\devel\ctrlr\nightly\Builds\Generated\Windows\Standalone\.\..\..\..\..\Bin\Standalone\Win32\Ctrlr-Debug-Win32.exe,1

I checked, i used the -1 and killed explorer.exe (nothing). Changed to 1 manualy in regedit, killed explorer and it works.

 

PS do you think something similar is possible for OSX, i know Linux is not an option but OSX has this feature so it must be doable, i don't know what to google to find out how, maybe something like http://stackoverflow.com/questions/3344157/setting-default-application-for-given-file-extension-on-mac-os-x-from-code


#4

Well, in tracktion we pass 101 to that function and AFAIK it works..


#5

Now i don't know what to do, 101 does make the icons in my folder go all "unknown" when I use -1 they go to the icon of the program.

i'll try a different windows version in a vm and see.


#6

I can't get it to work with Tracktion either, see attached screenshot after installation of latest Tracktion i could find.

http://bayimg.com/kAPIHAaEG

and yes my -1 works with my app, and the icons show up in explorer


#7

Thanks, will investigate..