The "Icon" Command |
This command adds a file to the MSI "Icon" table.
The icon file should ideally only contains icons it should not be a large execuable which just happens to contain icons (see the "Icon Tools" section for more information).
The macro takes these parameters:
These files should be small (they increase the size of the installer and the installed footprint)! This is particularly the case if you are creating advertised icons as the whole point of it is that the installation gets delayed, for this reason this icon file would seldom if ever be the name of the executable file being used as a shortcut (if required the icon can be extracted to create a smaller file).
For convenience I use normal windows ".ICO" files so that each icon can be easy updated without having an impact on the others. When using ".ICO" files the icon is refered to as icon number 0.
See the "icon tools" section for icon editors and extractors.
In my experience when using ".ICO" files, the key must end in ".EXE" for shortcut icons to display them.
If the "key" beings with "@" then what follows is not a key but an alias, a 'randomish" key will be generated for you and assigned to the alias (see below for more details).
Due to OLE storage restritions this key is restricted to 57 characters..
Please also see the "COMPANY_PRODUCT_ICON" macro.
The default for this parameter can be set via the DEFAULT_ICON_DOCO macro. The initial value for this is "Y".
Icon Alias |
Sometimes you will need to specify the exact key that needs to be used for an icon although this is likely to be rare.
All Windows versions have an icon caching bug which may prevent your new icon being displayed on a users computer if they had previously installed your product, a minor issue but a very annoying one. A workaround is to always use icons with different names and as windows installer uses the icons "key" when creating the file you need to vary the key.
The alias facility serves two purposes, you don't need to know what the key will be and a variable key can be produced to work around the windows icon bug.
The alias can be referred to with the "ICON" parameter of the "Shortcut" command. The alias is case sensitive but may include any character.
Windows Bugs |
If you change the icons look and this does not get reflected in the installed product's shortcuts etc, you have two alternatives, rename the icon (use a different key - one way is to use a "alias" - see above) or put up with it (it will look OK when installed on clean machine).
EXAMPLE |
<$Icon "test.ico" Key="test.ico.exe">