cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
johnav
Level 3

Dynamically create shortcuts

Hi,

Platform : msi on XP
I have a requirement like this. I need to support a feature like install kit customization.

Eg: User can give a ini file in which he can mention "Product Name". Or user can directly modify the "Product Name" property in msi file itself. In cases, shortcuts created by installer on desktop as well as start menu should use new product name.

I tried following mechanisms.

1. I changed the shortcut name as "[Product Name]". But I am getting a shortcut exactly as "[Product Name]", not using the value of [Product Name].

2. I added few Custom Actions. One for adding shortcuts, second for removing shortcuts and third for Roll backing shortcuts
For adding shortcuts I used "AddFolderIcon" function for removing it I used DeleteFolderIcon
This mechanism also has some problem when user uses ini file to specify the new product name.

so I would like to know whether there are any other mechanisms to achieve this requirement ?
Please help me. I am new to installshield.

Thanks
John
Labels (1)
0 Kudos
(1) Reply
UCinstall
Level 2

It sounds like you are using the InstallScript AddFolderIcon method, correct?

The syntax for that is as follows:

AddFolderIcon ( szProgramFolder, szItemName, szCommandLine, szWorkingDir, szIconPath, nIcon, szShortCutKey, nFlag );

Now it sounds like for the value in place of szItemName you maybe have something like this:

AddFolderIcon ( szProgramFolder, ""[Product Name]", szCommandLine, szWorkingDir, szIconPath, nIcon, szShortCutKey, nFlag );

If that's the case, it's just going to treat that as a string and you will literally get "[Product Name]" as your shortcut name, which sounds like what you are encountering.

To get a property from the MSI you want to do something like this:

MsiGetProperty(hMSI, "[Product Name]", szPropertyVal, nLength);

That will place the value of the property into the variable szPropertyVal, which you can then pass into the AddFolderIcon method 🙂
0 Kudos