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.
If the call to MsiGetUserInfo fails, call the MsiCollectUserInfo function to collect user information.
- Display a default user interface, if necessary, by calling the MsiSetInternalUI function.
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:
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.