IUIAutomation5::AddNotificationEventHandler 方法 (uiautomationclient.h)

注册处理通知事件的方法。

注意 在实现事件处理程序之前,应熟悉了解线程处理问题中所述 的线程问题
 

语法

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

参数

[in] element

类型: IUIAutomationElement*

指向与事件处理程序关联的 UI 自动化 元素的指针。

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