Level 2

Manually Create Shortcut on Desktop for 64 bit OS Can't find it

Hi all,

I hope someone can help me.
i m using the following code:

version 1:
AddFolderIcon( FOLDER_DESKTOP, sShortcutText, "\"" + INSTALLDIR ^ "myapplication.exe\"", INSTALLDIR, INSTALLDIR ^ "shortcut.ico", 0, "", NULL);
After installation the icon is the exe file icon and not the (INSTALLDIR ^ "shortcut.ico").
if you right click, go to properties and click "Change Icon..." you get an error: "%ProgramFiles%\MyAppPath\shortcut.ico does not exist." but the icon exist in "%ProgramFiles% (x86)\MyAppPath\shortcut.ico".

version 2 (put the fullpathname of the icon in quotes) :
AddFolderIcon( FOLDER_DESKTOP, sShortcutText, "\"" + INSTALLDIR ^ "myapplication.exe\"", INSTALLDIR, "\"" + INSTALLDIR ^ "shortcut.ico\"", 0, "", NULL);
The icon is blank until you go to properties and click "Change Icon...", you do not have to do anything more because the path is the right one: "%ProgramFiles% (x86)\MyAppPath\shortcut.ico".
BUT, you still have to go to properties and click "Change Icon...". 😞

Now Flexera help says, for the icon's full path:
"Do not call LongPathToQuote to enclose this file name in quotation marks. InstallShield automatically encloses these paths in quotation marks."

If you do not put quotes is passing the wrong path, but even if you put the icon stays blank even after restart of the computer.

Can somebody help here, PLEASE?

Thank you
Labels (1)
0 Kudos
2 Replies
Level 7

A couple of comments (but not really an answer).

1) I recently came across this note to the MSI Icon table which indicates that the Windows Shell requires that if an icon file is used, the extension must be the same as the application (EXE and not .ico). We have always used .ico file and fought with strange behavior of the OS, which may be explained by this comment. I plan to use a MyAppIcon.exe file in the future to deploy the shortcuts icon.

2) Windows has an Icon Cache which sometimes gets out of sync and has to be cleared (probably due in part to the above issue). It has been a while since I had to do anything with this, but you might want to look at it.

Recreate the Icon-Cache file by deleting it
Delete the hidden file ShellIconCache (Win9x/NT4/2k):
C:\Windows\ShellIconCache or C:\Winnt\ShellIconCache

Note in WinXP each user has their own file that is called Iconcache.db:
C:\Documents and Settings\Your User Name\Local Settings\Application Data\Iconcache.db

Note in Vista each user has their own file that is called Iconcache.db:
0 Kudos
Level 2

Thanks for replying.

I tried to target an exe file instead of an ico file, it didn't work.

I tried to run a script to refresh the icon cash, it didn't work ether.
The script
set iconcache=%localappdata%\IconCache.db
echo The Explorer process must be killed to delete the Icon DB.
echo Please SAVE ALL OPEN WORK before continuing.
If exist "%iconcache%" goto delID
echo Icon DB has already been deleted.
exit /B
echo Attempting to delete Icon DB...
ie4uinit.exe -ClearIconCache
taskkill /IM explorer.exe /F
del "%iconcache%" /A
echo Icon DB has been successfully deleted. Please "restart your PC" now to rebuild your icon cache.
start explorer.exe
exit /B

I also tried changing the icon file and combine all three different case, but, no luck.

So, still no answer. 😞
0 Kudos