大网数据广告活动
安装更新与部署

Initializing an Application

· 52CE 我爱测

To enable installer functionality, an application must call a number of functions when it is initializing.

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

  1. Call the MsiGetProductCode function so the application can identify itself to the installer.

    The product code is a required parameter for many installer functions.

  2. 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.

  3. 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.

  4. Call the MsiEnableLog function to set the logging level.

  5. 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.
  6. 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.

Source: Microsoft Learn / Windows Win32 documentation by Microsoft and contributors. Documentation licensed CC BY 4.0. Code samples are covered by the MIT License. Converted from Markdown, with links normalized and embedded media omitted.

资料来源与适用范围

资料来源
Microsoft Learn / Windows Win32 documentation
适用范围
Windows Win32 API · Source date 05/31/2018
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY 4.0 (documentation), MIT (code samples)

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。