Archive: DefaultIcon


DefaultIcon
Hi,

I'm using the following code.


WriteRegStr HKCR ".mask" "" "Kids Mask Factory Mask File"
WriteRegStr HKCR "Kids Mask Factory Mask File" "" "Kids Mask Factory Mask File"
WriteRegStr HKCR "Kids Mask Factory Mask File\DefaultIcon" "" "D:\RBCode\KidsMaskPrint\DocumentImageBuild\icon.ico"
WriteRegStr HKCR "Kids Mask Factory Mask File\Shell\Open\Command" "" '"$INSTDIR\kidsmaskfactory.exe" %1'
!define SHCNE_ASSOCCHANGED 0x8000000
!define SHCNF_IDLIST 0
System::Call 'Shell32::SHChangeNotify(i ${SHCNE_ASSOCCHANGED}, i ${SHCNF_IDLIST}, i 0, i 0)'


The icon gets displayed fine on my pc but on others it doesn't. I had thought it was because of the hard coded path, but looking at examples on this forum it should work?

Any ideas?

You're giving it "D:\RBCode\KidsMaskPrint\DocumentImageBuild\icon.ico" for the icon path which no doubt is a path local to you (on your computer)?
This wouldn't be the same on all computers.
You need to extract the .ico file yourself with File and $INSTDIR (or some other variable) should be in that path.

-Stu


Hi,

Thanks for your reply.

Well I could do it that way, but I didn't want to install the icon file to the installation directory.

I guess I have no choice ?


Well logically you can't set an icon for a shortcut on an end users' machine to an icon that only exists on your machine?

Hope you see my point.

-Stu


You could embbed multiple icons as a resource in your application and then make a shortcut where you also give the iconindex you want to display.

See the NSIS helpfile for the syntax:

link.lnk target.file [parameters [icon.file [icon_index_number [start_options [keyboard_shortcut [description]]]]]]

You can even add an Icon to the EXE with a resourceeditor if you do not have the source.