共用方式為


IUIAutomationElement::GetCurrentPatternAs 方法 (uiautomationclient.h)

擷取這個 使用者介面自動化 專案上指定之模式的控件模式介面。

語法

HRESULT GetCurrentPatternAs(
  [in]  PATTERNID patternId,
  [in]  REFIID    riid,
  [out] void      **patternObject
);

參數

[in] patternId

類型: PATTERNID

控制項模式的識別項。 如需控件模式標識碼的清單,請參閱 控件模式識別符

[in] riid

類型: REFIID

要透過 ppv 擷取之介面 IID 的參考。

[out] patternObject

類型: void**

接收 riid 中要求的介面指標。

傳回值

類型: HRESULT

如果此方法成功,則會傳回 S_OK。 否則,它會傳回 HRESULT 錯誤碼。

備註

建議您使用在 Objbase.h 中定義的 IID_PPV_ARGS 宏來封裝 riidppv 參數。 此宏會根據 ppv 中值所指向的介面提供正確的 IID,這可消除編碼錯誤的可能性。

規格需求

需求
最低支援的用戶端 Windows 7、Windows Vista sp2 和 Platform Update for Windows Vista、Windows XP with SP3 和 Platform Update for Windows Vista [僅限桌面應用程式]
最低支援的伺服器 Windows Server 2008 R2、Windows Server 2008 SP2 和 Platform Update for Windows Server 2008、Windows Server 2003 SP2 和 Platform Update for Windows Server 2008 [僅限桌面應用程式]
目標平台 Windows
標頭 uiautomationclient.h (包含 UIAutomation.h)

另請參閱

概念

GetCachedPatternAs

GetCurrentPattern

IUIAutomationElement

參考

UI 自動化控制項模式概觀