msiCloseHandle 函式 (msi.h)

MsiCloseHandle 函式會關閉開啟的安裝句柄。

語法

UINT MsiCloseHandle(
  [in] MSIHANDLE hAny
);

參數

[in] hAny

指定任何開啟的安裝句柄。

傳回值

意義
ERROR_INVALID_HANDLE
無效的句柄已傳遞至 函式。
ERROR_SUCCESS
此函數已成功。
 
 

備註

必須從要求建立句柄的相同線程呼叫 MsiCloseHandle

下列函式會藉由呼叫 MsiCloseHandle 來提供應該關閉的句柄:

MsiCreateRecordMsiGetActiveDatabaseMsiGetLastErrorRecordMsiOpenPackageMsiOpenProductMsiOpenDatabaseMsiDatabaseOpenViewMsiViewFetchMsiViewGetColumnInfoMsiDatabaseGetPrimaryKeysMsiGetSummaryInformationMsiEnableUIPreview 請注意,撰寫自定義動作時,建議使用 PMSIHANDLE 類型的變數,因為安裝程式會關閉 PMSIHANDLE 物件當它們超出範圍時,您必須呼叫 MsiCloseHandle 來關閉 MSIHANDLE 物件。

例如,如果您使用類似下列的程式代碼:

MSIHANDLE hRec = MsiCreateRecord (3) ;

請將其變更為:

PMSIHANDLE hRec = MsiCreateRecord (3) ;

規格需求

需求
最低支援的用戶端 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 Run-Time 需求。
目標平台 Windows
標頭 msi.h
程式庫 Msi.lib
Dll Msi.dll

另請參閱

處理管理功能