IUIAutomation::AddStructureChangedEventHandler 方法 (uiautomationclient.h)

註冊處理結構變更事件的方法。

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

語法

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

參數

[in] element

類型: IUIAutomationElement*

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

scope

[in] cacheRequest

類型: IUIAutomationCacheRequest*

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

[in] handler

類型: IUIAutomationStructureChangedEventHandler*

處理結構變更事件之 物件的指標。

傳回值

類型: 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)

另請參閱

快取 使用者介面自動化 屬性和控件模式

概念

IUIAutomation

參考

RemoveAllEventHandlers

RemoveStructureChangedEventHandler

訂閱 使用者介面自動化 事件

了解線程問題