Initializing an Application
To enable installer functionality, an application must call a number of functions when it is initializing. For more information, see Installation Mechanism. The following steps describe how to use the installer to initialize an application:
To initialize an application
- Call the
MsiGetProductCode function so the application can identify itself to the installer.
The product code is a required parameter for many installer functions.
- Call the MsiGetUserInfo function to collect user information the first time the application starts.
- Display a default user interface, if necessary, by calling the
To author your own user interface, register it with the installer by calling the MsiSetExternalUI function.
- Call the MsiEnableLog function to set the logging level.
- Present the user with available features by enumerating the features of your application. You can enumerate features in the following ways:
- Query the installer feature-by-feature. For example, before the application draws a button or a menu item, the application calls the MsiQueryFeatureState function so the installer can check that the feature is available.
- Enumerate all of the available features at once by calling the MsiEnumFeatures function. To use this function, the application must call MsiEnumFeatures repeatedly while incrementing an index.
- Get detailed information about the current installation by calling the following enumeration functions repeatedly, incrementing an index variable for each call:
- Call the MsiEnumProducts function to enumerate products registered with the installer.
- Call the MsiEnumComponents function to enumerate components.
- Call the MsiEnumComponentQualifiers function to enumerate component qualifiers.
- Call the MsiEnumClients function to enumerate the products for a particular component.
If the return value on an enumeration function is ERROR_SUCCESS, there are still more items to be enumerated and the function should be called again with an incremented index variable. If the return value is ERROR_NO_MORE_ITEMS, then all of the items have been enumerated, and the function should not be called again.