Sooz24
27th October 2010 20:41 UTC
Icon for a Start Menu item generated by CreateDirectory
I'm sure there is a simple answer to this...
I have an install that creates the following entries in the Start Menu
MyApp
Run MyApp
Uninstall MyApp
Both Run MyApp and Uninstall MyApp correctly show their icons. The parent 'MyApp' does not.
I'm using the following definition
CreateDirectory "$SMPROGRAMS\$StartMenuFolder"
CreateShortCut "$SMPROGRAMS\$StartMenuFolder\MyApp.lnk" "$INSTDIR\System\MyApp.exe" \
" " "$INSTDIR\System\MyApp.ico" "" SW_SHOWMINIMIZED
CreateShortCut "$SMPROGRAMS\$StartMenuFolder\Uninstall MyApp.lnk" "$INSTDIR\Uninstall.exe" \
" " "$INSTDIR\System\MyApp.ico" ""
How do I specify the missing icon?
Afrow UK
27th October 2010 20:50 UTC
Since when did start menu folders have program specific icons (by default)?
Stu
Wizou
27th October 2010 21:51 UTC
It is possible by placing a desktop.ini file in your folder. Give the file the attributes "hidden" and "system".
Inside desktop.ini, write the following: (with your NSIS script, so you can use the $INSTDIR)
[.ShellClassInfo]
IconResource=C:\YourPath\MyProgram.exe,0
(you can use an EXE, DLL or ICO file. See also
http://msdn.microsoft.com/en-us/libr...8VS.85%29.aspx)
Apparently, you must also set the attribute "Read-only" on your folder. (only, not on the files inside)
And please make sure your custom folder icon still looks like a folder, otherwise the user would feel strange..
Anders
28th October 2010 00:59 UTC
I think the attributes you need to set can vary (IIRC there is a registry setting for it) and the page you link to tells you which documented function to call (Or just set system and read-only to be on the safe side)
jiake
28th October 2010 13:23 UTC
Maybe he said that one of the shortcuts created in start menu folder by his installer doesn't have an icon, that likes an executable file without any icon resource. He wants to show the icon he set in script.
flizebogen
31st October 2010 08:14 UTC
Making Icons for folders is a nice thing especially in a corporate environment. This way users can distinguish between start menu entries provided by IT department from the rest.
I ues this construct fairly often, it even works with limited user rights:
"!insertmacro PATH_MAKE_SYSTEM_FOLDER"
>!macro PATH_MAKE_SYSTEM_FOLDER pszPath
System
::Call "shlwapi::PathMakeSystemFolder(t '${pszPath}') i."
>!macroend
Section "Make Shortcuts"
WriteINIStr "$SMPROGRAMS\Some Folder\Desktop.ini" ".ShellClassInfo" "IconFile" "$SYSDIR\shell32.dll"
WriteINIStr "$SMPROGRAMS\Some Folder\Desktop.ini" ".ShellClassInfo" "IconIndex" "188"
${PathMakeSystemFolder} "$SMPROGRAMS\Some Folder"
>SectionEnd
>