Product.FeatureState 方法

FeatureState 属性是此产品的实例的功能的安装状态。

此属性使用对象的 ProductCode、UserSid 和 Context 来调用 MsiQueryFeatureStateEx。 功能 ID 作为参数提供。

语法

Product.FeatureState(
  FeatureId
)

参数

FeatureId

出现在 Feature 表的 Feature 列中的功能 ID。

返回值

此方法不返回值。

备注

如果调用成功,则属性包含 DWORD 格式的值。

状态 含义
INSTALLSTATE_ADVERTISED 该功能已播发。
INSTALLSTATE_LOCAL 该功能已在本地安装。
INSTALLSTATE_SOURCE 该功能已安装为从源运行。

 

如果调用失败,则此属性包含来自 MsiQueryFeatureStateEx 的错误代码。

错误 含义
ERROR_ACCESS_DENIED 调用进程必须具有管理权限才能获取为当前用户以外的用户安装的产品的信息。
ERROR_BAD_CONFIGURATION 配置数据已损坏。
ERROR_INVALID_PARAMETER 向该函数传递了无效参数。
ERROR_SUCCESS 函数已成功完成。
ERROR_UNKNOWN_FEATURE 功能 ID 不标识已知功能。
ERROR_UNKNOWN_PRODUCT 产品代码未标识已知产品。
ERROR_FUNCTION_FAILED 意外的内部故障。

 

要求

要求
版本
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 2000 上的 Windows Installer 3.0 或更高版本
DLL
Msi.dll
IID
IID_IProduct 定义为 000C10A0-0000-0000-C000-000000000046

另请参阅

Product

MsiQueryFeatureStateEx

在 Windows Installer 2.0 及更低版本中不受支持