Product.FeatureState 方法

FeatureState屬性是此功能實例的安裝狀態。

這個屬性會使用物件的ProductCodeUserSidCoNtext呼叫MsiQueryFeatureStateEx。 功能識別碼會以參數的形式提供。

語法

Product.FeatureState(
  FeatureId
)

參數

FeatureId

功能識別碼會出現在 功能資料表的 [功能] 資料行中。

傳回值

這個方法不會傳回值。

備註

如果呼叫成功,屬性會包含值做為 DWORD

狀態 意義
INSTALLSTATE_ADVERTISED 這項功能已公告。
INSTALLSTATE_LOCAL 此功能會安裝在本機。
INSTALLSTATE_SOURCE 此功能會安裝為從來源執行。

 

如果呼叫失敗,屬性會包含 MsiQueryFeatureStateEx的錯誤碼。

錯誤 意義
ERROR_ACCESS_DENIED 呼叫程式必須具有系統管理許可權,才能為目前使用者以外的使用者安裝產品。
ERROR_BAD_CONFIGURATION 設定資料已損毀。
ERROR_INVALID_PARAMETER 不正確參數已傳遞至 函式。
ERROR_SUCCESS 語言函式已順利完成。
ERROR_UNKNOWN_FEATURE 功能識別碼不會識別已知的功能。
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

另請參閱

產品

MsiQueryFeatureStateEx

Windows Installer 2.0 和更早版本中不支援