IUIAutomation::AddAutomationEventHandler 方法 (uiautomationclient.h)
註冊處理 Microsoft 使用者介面自動化 事件的方法。
注意 實作事件處理程式之前,您應該先熟悉了解 線程問題中所述的線程問題。
語法
HRESULT AddAutomationEventHandler(
[in] EVENTID eventId,
[in] IUIAutomationElement *element,
TreeScope scope,
[in] IUIAutomationCacheRequest *cacheRequest,
[in] IUIAutomationEventHandler *handler
);
參數
[in] eventId
類型: EVENTID
方法所處理之事件的標識碼。 如需事件標識碼的清單,請參閱 事件標識碼。
[in] element
類型: IUIAutomationElement*
要與事件處理程式相關聯之 使用者介面自動化 專案的指標。
scope
[in] cacheRequest
類型: IUIAutomationCacheRequest*
快取要求的指標,如果沒有想要快取,則為 NULL 。
[in] handler
類型: IUIAutomationEventHandler*
處理事件之 物件的指標。
傳回值
類型: HRESULT
如果此方法成功,則會傳回 S_OK。 否則,它會傳回 HRESULT 錯誤碼。
備註
使用者介面自動化 客戶端不應該使用多個線程來新增或移除事件處理程式。 如果在相同客戶端進程中新增或移除另一個事件處理程式時,就會產生非預期的行為。
規格需求
需求 | 值 |
---|---|
最低支援的用戶端 | Windows 7、Windows Vista SP2 和 Platform Update for Windows Vista、Windows XP 含 SP3 和適用於 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) |
另請參閱
概念
參考
意見反應
https://aka.ms/ContentUserFeedback。
即將登場:在 2024 年,我們將逐步淘汰 GitHub 問題作為內容的意見反應機制,並將它取代為新的意見反應系統。 如需詳細資訊,請參閱:提交並檢視相關的意見反應