MsiUseFeatureW 函数 (msi.h)

MsiUseFeature 函数递增特定功能的使用计数,并指示该功能的安装状态。 此函数应用于指示应用程序使用功能的意图。

语法

INSTALLSTATE MsiUseFeatureW(
  [in] LPCWSTR szProduct,
  [in] LPCWSTR szFeature
);

参数

[in] szProduct

指定拥有要使用的功能的产品的产品代码。

[in] szFeature

标识要使用的功能。

返回值

含义
INSTALLSTATE_ABSENT
未安装该功能。
INSTALLSTATE_ADVERTISED
该功能已播发。
INSTALLSTATE_BADCONFIG
配置数据已损坏。
INSTALLSTATE_INVALIDARG
函数参数无效。
INSTALLSTATE_LOCAL
此功能在本地安装并可供使用。
INSTALLSTATE_SOURCE
此功能从源安装并可供使用。
INSTALLSTATE_UNKNOWN
此功能未发布。
 
 

注解

MsiUseFeature 函数只能用于已知要发布的功能。 INSTALLSTATE_UNKNOWN表示程序尝试使用未发布的功能。 应用程序应通过调用 MsiQueryFeatureStateMsiEnumFeatures 来确定在调用 MsiUseFeature 之前是否发布该功能。 应用程序应在初始化时进行这些调用。 应用程序应仅使用已知要发布的功能。

注意

msi.h 标头将 MsiUseFeature 定义为别名,该别名根据 UNICODE 预处理器常量的定义自动选择此函数的 ANSI 或 Unicode 版本。 将非特定编码别名的使用与非非特定编码的代码混合使用可能会导致不匹配,从而导致编译或运行时错误。 有关详细信息,请参阅 函数原型的约定

要求

要求
最低受支持的客户端 Windows Server 2012、Windows 8、Windows Server 2008 R2 或 Windows 7 上的 Windows Installer 5.0。 Windows Server 2008 或 Windows Vista 上的 Windows Installer 4.0 或 Windows Installer 4.5。 Windows Server 2003 或 Windows XP 上的 Windows Installer。 若要了解 Windows Installer 版本所需的最低 Windows Service Pack,请参阅 Windows Installer 运行时要求。
目标平台 Windows
标头 msi.h
Library Msi.lib
DLL Msi.dll

另请参阅

仅限应用程序的函数