IUIAutomation::RemoveAllEventHandlers 方法 (uiautomationclient.h)

移除所有已註冊的 Microsoft UI 自動化事件處理常式。

Syntax

HRESULT RemoveAllEventHandlers();

傳回值

類型: HRESULT

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

備註

使用者介面自動化用戶端不應該使用多個執行緒來新增或移除事件處理常式。 如果在相同用戶端進程中新增或移除另一個事件處理常式,則發生非預期的行為。

如果事件與取消訂閱事件的要求同時收到,則事件可以在處理常式取消訂閱之後傳遞至事件處理常式。 最佳做法是遵循元件物件模型 (COM) 標準,並避免終結事件處理常式物件,直到其參考計數達到零為止。 在取消訂閱事件之後立即終結事件處理常式,如果事件延遲傳遞,可能會導致存取違規。

規格需求

   
最低支援的用戶端 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 [僅限桌面應用程式]
目標平台 Windows
標頭 uiautomationclient.h (包含 UIAutomation.h)

另請參閱

IUIAutomation

RemoveAutomationEventHandler

RemoveFocusChangedEventHandler

RemovePropertyChangedEventHandler

RemoveStructureChangedEventHandler