cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
fcallin1
Level 2

AddFolderIcon for all users with MSI

Hello,

I've been rewriting an old isntallscript installer into a new MSI and have run into an issue with Icons. We build the start menu shortcuts to go to
the standard location using the Shortcuts View (C:\ProgramData\Microsoft\Windows\Start Menu\Programs\My Company\My Folder\)
And then we use AddFolderIcon to create a folder icon that links to the above path but so that we can assign an icon and the user can click on the icon and go into a folder that lists our applications for that area.

The problem I am running into on Windows 8 specefically and probably 7 as well is that when you run it as a MSI you get an access denied error when it tries to write the folder to the common desktop (C:\users\Public\Desktop) but if I launch the setup.exe with elevate privledges the desktop folder creates properly.
Has anyone come across this or have any suggestions?

I could create the Desktop Icons using the Shortcuts View as well but I have not figured out a way to add a icon to the folders that are built which is required.

Thanks




RegDBSetDefaultRoot (HKEY_LOCAL_MACHINE);
RegDBGetKeyValueEx ( "Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders", "Common Desktop", nvType, svCommonDesktopFolder, nvSize );

szItemName = DESKTOP_SMS;

szCommandLine = ProgramMenuFolder ^ "My Company" ^ "My Folder";

szIconPath = ProgramFilesFolder ^ "My Files\\SMS1.ico";
LongPathToQuote (szCommandLine, TRUE);
// Add the shortcut to the desktop.
nResult = AddFolderIcon (svCommonDesktopFolder, szItemName, szCommandLine, szWorkingDir, szIconPath, nIcon, szShortCutKey, nFlag);
svError = FormatMessage(nResult);
MessageBox(svError,0);

Labels (1)
0 Kudos
(2) Replies
TsungH
Level 12

To create a shortcut to a folder, you may find this old thread useful.
0 Kudos
fcallin1
Level 2

I haven't tried this yet but I assume this would have the same problem with permissions trying to write to the all users desktop area.
0 Kudos