cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
RICOUK
Level 4

AddFolderIcon fodler shortcut

Hi,

I am wanting to add a shortcut to a folder that is installed as part of the program, however, from using the help documentation the code they give does not work (no real surprise!!)

This is what they suggested, with a few changes as theirs didn't compile!!

ProgDefGroupType(COMMON);
szFolder = Directory + "\\Program Name\\";
LongPathToQuote(szFolder, TRUE);
AddFolderIcon( ProgramMenuFolder + "\\Company Name\\", "Shortcut Name", szFolder, "", "", 0, "", NULL );


Anyone have a way that works to do this?

Thanks,
Rich
Labels (1)
0 Kudos
(5) Replies
RICOUK
Level 4

No one has done this before???

Rich
0 Kudos
SMadden
Level 6

What does the shortcut point to after it was created? Maybe the path is invalid.

E.g. make sure that the Directory variable doesn't end on a backslash already and you end up with a double backslash in your string. If you use the ^ instead of + "\\" it'll take care of that automatically.

I'd suggest changing the code to something like this and try again.

ProgDefGroupType(COMMON);
szFolder = Directory ^ IFX_PRODUCT_NAME;
LongPathToQuote(szFolder, TRUE);
AddFolderIcon( FOLDER_PROGRAMS ^ IFX_COMPANY_NAME, "Shortcut Name", szFolder, "", "", 0, "", NULL );

-Sandra
0 Kudos
RICOUK
Level 4

SMadden wrote:
What does the shortcut point to after it was created? Maybe the path is invalid.

E.g. make sure that the Directory variable doesn't end on a backslash already and you end up with a double backslash in your string. If you use the ^ instead of + "\\" it'll take care of that automatically.

I'd suggest changing the code to something like this and try again.

ProgDefGroupType(COMMON);
szFolder = Directory ^ IFX_PRODUCT_NAME;
LongPathToQuote(szFolder, TRUE);
AddFolderIcon( FOLDER_PROGRAMS ^ IFX_COMPANY_NAME, "Shortcut Name", szFolder, "", "", 0, "", NULL );

-Sandra


Hi,

Thanks for the reply,
The code that you have makes a link to the main exe file and tries to run that instead of opening a folder.

With the code I gave it creates the shortcut and the link is correct but it does not pick it up for some reason. Looking at a shortcut to the same folder which I manually create is exactly the same in the properties.

Thanks,
Rich
0 Kudos
SMadden
Level 6

you might have found a bug. I just created two test projects, one pure InstallScript with the code above and one Basic MSI using an InstallScript custom action using the code above.

the shortcut to the folder was successfully created with the pure InstallScript one, but failed when using the MSI with InstallScript custom action.

Sandra
0 Kudos
TsungH
Level 12

If the sample doesn't even compile, would you please file a doc bug with them? So that they will become aware of the problem, and can address this in the future release.

You can try creating a shortcut as mentioned here.
0 Kudos