Archive: CreateShortcut icon issue with icon location - hardcoded vs symbolic paths


CreateShortcut icon issue with icon location - hardcoded vs symbolic paths
Alright, I know there's tons of topics on icons.. I get icons working in general - this is a slightly more odd one..

I have a control panel applet (*.cpl) that has an icon resource in it.

This doesn't work:


CreateShortcut "$SMPROGRAMS\test\test.lnk" "$PROGRAMFILES\test\test.cpl" "" "$PROGRAMFILES\test\test.cpl" "0" "" "" "Open the Test Control Panel"

I get a relatively generic icon - the same as is displayed in e.g. Explorer for the .CPL file.

However, I -can- change it to the correct icon by changing the shortcut file's properties. So I used the ShellLink plugin to figure out what the difference between my output and the modified version was, and the result of that is that THIS does work:

CreateShortcut "$SMPROGRAMS\test\test.lnk" "$PROGRAMFILES\test\test.cpl" "" "%ProgramFiles%\test\test.cpl" "0" "" "" "Open the Test Control Panel"


I realize it's probably best to use symbolic pathnames wherever I can (and will adjust the installer code to fit - though that's going to be annoying with any '$INSTDIR' type variables), but I wouldn't have imagined it to break an icon display given that they point to the exact same file, just using different means.
Any thoughts out there as to why this might be so?

just linking to the .cpl is wrong, the default action could be anything...

try something like


CreateShortcut "$temp\test.lnk" "control.exe" '"$COMMONFILES\Microsoft Shared\Speech\sapi.cpl"' "$COMMONFILES\Microsoft Shared\Speech\sapi.cpl" 0 "" "" "Open the Test Control Panel"


noted and will adjust.. but I take it that has no bearing on the icon issue I mentioned?


I'd say the icon issue is a windows bug. You could try using the ShellLink plugin and see what happens when you try to create the "broken" shortcut with it