PDA

View Full Version : Associate icon to files created with a certain extension


wagner1308
17th April 2012, 11:25
Good morning people,

I need your help, I joined two extensions on windows with Nisis now I want to associate an icon for each of the two extensions that I have created and joined in windows.

I did so to associate the extensions that create

HKEY_CLASSES_ROOT WriteRegStr "My.Extension.MYE" "" "My Extension MYE"
HKEY_CLASSES_ROOT WriteRegStr "My.Extension.MYE \ shell \ open \ command" "" "$ INSTDIR \ Meu_executavel.exe" "% 1" '
WriteRegStr HKEY_CLASSES_ROOT. "mye" "" "My.Extension.MYE"

then I tried to associate the icons adiconando this line:

HKEY_CLASSES_ROOT WriteRegStr "My.Extension.MYE \ DefaultIcon" "" "$ INSTDIR \ desenho.ico" "% 1" '

then the code looks like this:

HKEY_CLASSES_ROOT WriteRegStr "My.Extension.MYE" "" "My Extension MYE"
HKEY_CLASSES_ROOT WriteRegStr "My.Extension.MYE \ shell \ open \ command" "" "$ INSTDIR \ Meu_executavel.exe" "% 1" '
HKEY_CLASSES_ROOT WriteRegStr "My.Extension.MYE \ DefaultIcon" "" "$ INSTDIR \ desenho.ico" "% 1" '
WriteRegStr HKEY_CLASSES_ROOT. "mye" "" "My.Extension.MYE"

But I can not work as associate icons to files that have the extension I created?

Thank you!

MSG
17th April 2012, 11:50
I think you shouldn't have a period after HKCR (x2).

wagner1308
17th April 2012, 12:10
I think you shouldn't have a period after HKCR (x2).

I do not understand what you told me you could give me an example or change what I put there so I can try?

Thank you.

MSG
17th April 2012, 12:29
WriteRegStr HKEY_CLASSES_ROOT. "mye" "" "My.Extension.MYE"

you have a period there.

Anders
17th April 2012, 20:27
DefaultIcon should look like:
c:\path\file.ico
c:\path\file.dll,3
c:\path\file.dll,-3
or
%1

If there is only one icon in the file you don't need the comma and number. Since this is not a command line, quotation marks are not necessary.
%1 only works if the filetype is bmp,ico,dll,cpl,exe etc.

antoniohl
19th April 2012, 07:36
I do this using the default windows associations then i do some modifications, originally was ft000001 then i changed to ft000002, using export registry entries.

try this:
WriteRegStr HKCR ".app" "" "ft000002"
WriteRegStr HKCR "ft000002" "" ""
WriteRegDWORD HKCR "ft000002" "EditFlags" 0
WriteRegDWORD HKCR "ft000002" "BrowserFlags" 8
WriteRegStr HKCR "ft000002\DefaultIcon" "" "$INSTDIR\MyApp.exe,0"
WriteRegStr HKCR "ft000002\shell\open\command" "" '$INSTDIR\MyApp.exe "%1"'

where [.app] is a sample extension, change [MyApp.exe] to your application name.
in this fragment ['$INSTDIR\MyApp.exe "%1"'] we can use single externally to use double quotation internally.

Its all.
antonio
(meu ingles nao tah lah muito bom)

Anders
19th April 2012, 15:52
You should quote the path: WriteRegStr HKCR "ft000002\shell\open\command" "" '"$INSTDIR\MyApp.exe" "%1"'