\
Source Code
Commands
Extn
This command is used to define a file extension and associate it
with a "ProgId" and one or more actions that can be performed on the
extension.
This command can not be nested and is required before
the "ExtnAction" command can be used.
This command takes these parameters:
- File Extension (positional)
This is the value of the file extension.
The leading "." is optional, if found it is removed.
This value is almost always supplied, it would not be supplied if
you wished to modify an existing ProgId.
If supplied but either "." or "" then that represents the
"missing file extension".
- Component (optional)
If not passed then the extension is assigned to the
"current component".
The component's attributes control installation and uninstallation conditions and behaviour.
- ProgId (optional)
This value is required if the "File extension" is missing
otherwise one will be generated based if required.
- Description (optional)
This is the description for the "ProgId".
- Icon (optional)
This is full name of an ico file, or perhaps a EXE or DLL file and
resource number.
- AlwaysShow (optional)
Explorer can be configured (and it is the default) to hide file
extensions. If you pass "Y" (in fact anything but "N")
for this value then the file extension will always be displayed.
- KeyPath (optional)
If this file value should be the
keypath for the component then
pass "Y" for this parameter.
- HKEY (optional)
This should be one of (see MSI doco for more info):
- CURRENT_USER (or HKCU)
- LOCAL_MACHINE (or HKLM)
- CURRENT_USER_OR_LOCAL_MACHINE (or HKMU or HKUM)
Registry in HKLM if per-machine install otherwise goes into HKCU (see "ALLUSERS" property). - CLASSES_ROOT (or HKCR)
Classes root is a merge between local machine and current user registry (at "Software\classes"). It may be best to use "CURRENT_USER", "LOCAL_MACHINE" or "CURRENT_USER_OR_LOCAL_MACHINE" instead to be absolutely sure what is being updated.
Note that "CLASSES_ROOT" is a mixture made up of "software\classes" registry information from current user and local machine registry hives.
The default for this parameter can be set via the DEFAULT_EXTN_HKEY macro. The initial value for this is "CLASSES_ROOT".
| Main Extn/ExtnAction Related Options |
Please see the "options for commands" section of the manual.
#define? EXTN_DEFAULT_PROGID_PREFIX ProgId4.
#define? DEFAULT_EXTN_HKEY CLASSES_ROOT
#define? EXTN_ACTION_COMMAND_TYPE STRING ;;or EXPSTRING (to expand environment variables etc)?
Also see the "TryMeExtnAction.MM" example.
<$Component "TestExtnMacro" Create="Y" Directory_="INSTALLDIR">
<$Extn ".TestExtn" KEYPATH="Y" Description="Test Extension">
<$ExtnAction Key="Open" Description="EDIT FILE" Command=^notepad.exe "%1"^>
<$/Extn>
<$/Component>