IUIAutomation::AddPropertyChangedEventHandlerNativeArray 方法 (uiautomationclient.h)

註冊處理屬性變更事件的原生陣列的方法。

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

語法

HRESULT AddPropertyChangedEventHandlerNativeArray(
  [in] IUIAutomationElement                     *element,
  [in] TreeScope                                scope,
  [in] IUIAutomationCacheRequest                *cacheRequest,
  [in] IUIAutomationPropertyChangedEventHandler *handler,
  [in] PROPERTYID                               *propertyArray,
  [in] int                                      propertyCount
);

參數

[in] element

類型:IUIAutomationElement*

與事件處理程式相關聯的UI Automation元素指標。

[in] scope

類型:TreeScope

要處理的事件範圍;也就是說,無論是元素本身,還是在其祖先和子系上。

[in] cacheRequest

類型:IUIAutomationCacheRequest*

快取要求的指標,如果不需要任何快取,則 NULL

[in] handler

類型:IUIAutomationPropertyChangedEventHandler*

處理事件之 物件的指標。

[in] propertyArray

類型:PROPERTYID*

相關UI自動化屬性標識碼的指標。 如需屬性識別碼的清單,請參閱 屬性識別碼

[in] propertyCount

類型:int

propertyArray 中的屬性識別碼數目

傳回值

類型:HRESULT

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

如需示範如何實作介面的程式代碼範例,讓客戶端能夠接收及處理Microsoft UI 自動化事件(包括 AddPropertyChangedEventHandlerNativeArray),請參閱 如何實作事件處理程式

言論

專案所指定的UI專案 可能不支援由 propertyArray 參數所指定的屬性。

這個方法的作用與 IUIAutomation::AddPropertyChangedEventHandler相同,但採用屬性標識符的一般數位,而不是 SAFEARRAY。

使用者介面自動化客戶端不應該使用多個線程來新增或移除事件處理程式。 如果在相同客戶端進程中新增或移除另一個事件處理程式,則非預期的行為可能會導致。

要求

要求 價值
最低支援的用戶端 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 [僅限傳統型應用程式]
目標平臺 窗戶
標頭 uiautomationclient.h (include UIAutomation.h)

另請參閱

AddPropertyChangedEventHandler

快取UI自動化屬性和控制項模式

概念

IUIAutomation

參考

RemoveAllEventHandlers

RemovePropertyChangedEventHandler

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

了解線程問題