Archive: Shortcut Icon


Shortcut Icon
I have created a VB application that uses a "home-made" icon for the .exe icon. Do I need to copy this icon to the destination hard drive in order to use it for shortcut icons??? I tried simply pointing to the application itself, but that didn't seem to work. So, I guess my full question is:

Is there a way to pull the icon from the .exe or, do I need to copy the icon to the hard drive and use that in the path for my shortcut icon?

Thanks in advance!!


Although I haven't touched VB for a little while, if I recall correctly, you should be able to specify the icon for the application in VB before you compile it.

Is that what you were after? (I found it a little hard to understand what exactly you were asking) Otherwise, you can specify the icon file and index when you create a shortcut in NSIS (it's just in the Users Manual).

Ta,
Dave.


I'll try to be clearer:

I have a VB application where I've assigned it an icon during compile time...and this works fine. When I install this .exe and make a desktop shortcut to this .exe on the destination machine, the shortcut does NOT display the icon. I attempted to set the icon parameter of the "CreateShortcut" method in NSIS to the .exe...hoping that the shortcut would pick-up the icon from that .exe...but, it doesn't appear to work. So, I've ended up copying the actual .ico onto the destination machine and setting the CreateShortcut icon parameter to this .ico...which works.

My question is:
Is there a way to get the CreateShortcut icon parameter to pull the icon from the .exe? I would rather not copy my .ico onto the destination machine...if possible.

Thanks again, and sorry for the confusion my first posting may have caused!


This code should work:

CreateShortCut "$SMPROGRAMS\Example\Example.lnk" "$INSTDIR\vbprog.exe" "" "$INSTDIR\vbprog.exe" 0

Vytautas

That's exactly what I tried, Vytautas, but it doesn't seem to work. I'll try it again when I get to my home PC...but, I'm expecting it not to work. Any other suggestions?


Make sure that you include the empty quotes "". Also does the shortcut display any icon and if so what does it look like, attach a screenshot if possible.

Vytautas


The icon that gets displayed is the default .exe windows icon...you know, the white box with a blue bar across the top. I'm away from my home PC right now or else I'd post a screen shot. You can see the icon I'm talking about by simply creating hello.txt and renaming it to hello.exe in a folder within windows.


You can analyse the problem using the Explorer's
properties TAB -> ChangeIcon, then you can see how many icons your exe have and which index is the correct,

good luck,
Ramon


Thanks, that's a good idea, ramon18!