PDA

View Full Version : Removed old shortcuts



alorbach
07-02-2007, 08:40 AM
Hi all,

I have created a new minor setup of a basic installshield project, and some shortcut names have been changed. Now if I upgrade the installation, I have duplicated shortcuts in my application's programm group.

Is there any easy why to remove the old shortcuts, or replace them by the new ones?

thanks

joshstechnij
07-02-2007, 10:51 AM
You could either author entries into the RemoveFile table of your project that specifies the shortcut LNK files to be deleted, or you could use a custom action (VBScript, DLL, EXE, InstallScript, etc.) that deletes these files for you. You can find information on the RemoveFile table in the following article:
RemoveFile Table - http://msdn2.microsoft.com/en-us/library/aa371201.aspx

Another approach would be to author a major upgrade instead of a minor upgrade, which will uninstall the existing installation and then install the new installation, eliminating the need to author the RemoveFile table or a custom action.

alorbach
07-03-2007, 07:33 AM
I tried a major upgrade before as well, it didn't remove the install files - but I did not choose to remove first and install then, I use install first, then remove unused files.

However during meantime I searched arround a lot of threads in this forum and found a good way to remove my old shortcuts. For all others searching, here is what todo:

1. Create a new Installscript file, call the function ExFn_DeleteFolderIcon for example. Then use the DeleteFolderIcon to remove your legacy shortcuts, do not check for the error code (only for testing maybe), because the function will kindly fail if the shortcut is not available. Here is a sample function:



function ExFn_DeleteFolderIcon(hMSI)
// To Do: Declare local variables.
begin

// Delete Legacy Icons just in case!
DeleteFolderIcon (FOLDER_PROGRAMS + "\\MyProgram", "Old Client Shortcut");
DeleteFolderIcon (FOLDER_PROGRAMS + "\\MyProgram", "Old manual Shortcut");

end;

"Old Client Shortcut" and "Old manual Shortcut" are of course the old shortcutnames.

Now you need to create a new custom action. Call the Action RemoveOldShortCuts for example, perform the wizard (select Installscript, select the functionname and so on. Only add the Action into a suitable position in the Install Exec Sequence, I used After Create Shortcuts to make sure the FOLDER_PROGRAMS is available.

I hope this helps others with the same problem.