共用方式為


IUIAutomation5::AddNotificationEventHandler 方法 (uiautomationclient.h)

註冊處理通知事件的方法。

注意 實作事件處理程式之前,您應該先熟悉了解 線程問題中所述的線程問題
 

語法

HRESULT AddNotificationEventHandler(
  [in] IUIAutomationElement                  *element,
       TreeScope                             scope,
  [in] IUIAutomationCacheRequest             *cacheRequest,
  [in] IUIAutomationNotificationEventHandler *handler
);

參數

[in] element

類型: IUIAutomationElement*

與事件處理程式相關聯之 使用者介面自動化 專案的指標。

scope

[in] cacheRequest

類型: IUIAutomationCacheRequest*

快取要求的指標,如果沒有想要快取,則為 NULL

[in] handler

類型: IUIAutomationNotificationEventHandler*

處理通知事件之 物件的指標。

傳回值

類型: HRESULT

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

規格需求

需求
最低支援的用戶端 Windows 10 版本 1709 [僅限傳統型應用程式]
最低支援的伺服器 Windows Server 版本 1709 [僅限傳統型應用程式]
目標平台 Windows
標頭 uiautomationclient.h (包含 UIAutomation.h)

另請參閱

IUIAutomation5

RemoveAllEventHandlers