IonicWind Software

Aurora Compiler => General Discussion => Topic started by: ExMember001 on November 24, 2006, 06:34:48 AM

Title: Registering Filetypes
Post by: ExMember001 on November 24, 2006, 06:34:48 AM
Hi,
i've managed to get my program start playing when an audio file is double clicked in explorer...
but the icon is not retrieve from my program ressource.. (reboot just put icon to blank)

here is what i'm doing:
i've added an icon ressource as id 1

then i set the registry like that:

        ARegSetValue("HKEY_CLASSES_ROOT\\.mp1","AmpKC");
ARegSetValue("HKEY_CLASSES_ROOT\\.mp2","AmpKC");
ARegSetValue("HKEY_CLASSES_ROOT\\.mp3","AmpKC");
ARegSetValue("HKEY_CLASSES_ROOT\\.ogg","AmpKC");
ARegSetValue("HKEY_CLASSES_ROOT\\.flac","AmpKC");
ARegSetValue("HKEY_CLASSES_ROOT\\.wma","AmpKC");
ARegSetValue("HKEY_CLASSES_ROOT\\.aif","AmpKC");
ARegSetValue("HKEY_CLASSES_ROOT\\.wav","AmpKC");
ARegSetValue("HKEY_CLASSES_ROOT\\.cda","AmpKC");
ARegSetValue("HKEY_CLASSES_ROOT\\.m3u","AmpKC");

ARegSetValue("HKEY_CLASSES_ROOT\\AmpKC","AmpKC File");
ARegSetValue("HKEY_CLASSES_ROOT\\AmpKC\\DefaultIcon",Getstartpath()+"AmpKC.exe,1");
ARegSetValue("HKEY_CLASSES_ROOT\\AmpKC\\Shell","");
ARegSetValue("HKEY_CLASSES_ROOT\\AmpKC\\Shell\\open","");
ARegSetValue("HKEY_CLASSES_ROOT\\AmpKC\\Shell\\open\\command",Getstartpath()+"AmpKC.exe %1");


anyhone know why my icon is not set to the files ?
Title: Re: Registering Filetypes
Post by: Steven Picard on November 24, 2006, 07:16:35 AM
This is good.  Thanks for sharing!
Title: Re: Registering Filetypes
Post by: Ionic Wind Support Team on November 24, 2006, 11:08:27 AM
the ,1 isn't the ID of the icon.   It means the '1st icon' in the resource directory of the executable.

For your default icon, the one that you want to show up as the executables icon when viewed with the explorer, use the ID of 101.

Title: Re: Registering Filetypes
Post by: ExMember001 on November 24, 2006, 10:34:29 PM
ok, i've set the id to 101 in my program, now the icon show in the caption without setting it manually, great thanx :)

if the icon at id 101 is the only ressource i added so far, using AmpKC,1 in registry should work?
but it doesnt...
Title: Re: Registering Filetypes
Post by: Ionic Wind Support Team on November 24, 2006, 10:51:02 PM
Should.  But I haven't had much luck myself with Windows icons.  Half the time they work like they should, the other half of the time I have to reboot many times.

I would verify with RegEdit that everything looks normal.  One thing I do rememember is if the path has spaces in it then it has to be converted to a short filename or the icon won't be picked up.  Try ,0 as well. 

The entry for the Mozilla browser shows this for the defaulticon setting:

C:\PROGRA~1\MOZILLA.ORG\MOZILLA\MOZILLA.EXE,0

Which is the short filename since "program files" has a space in it.  You could also try surrounding it with quotes.

Paul.
Title: Re: Registering Filetypes
Post by: ExMember001 on November 24, 2006, 11:01:03 PM
interresting, thanx ;)
i'll try the 0 and short filename.
Title: Re: Registering Filetypes
Post by: ExMember001 on November 24, 2006, 11:08:22 PM
using AmpKC,0 resolve it  :o
no reboot or shortfilename needed, thanx a lot  ;D
Title: Re: Registering Filetypes
Post by: Ionic Wind Support Team on November 24, 2006, 11:35:01 PM
Sometimes you hit the target with a shotgun easier than a rifle ;)  In other words when all else fails try things at random.