//------------------------------------------------------ // // Private Methods // //------------------------------------------------------ #region Private Methods private static void OnToolTipEvents(IntPtr hwnd, int eventId, object idProp, int idObject, int idChild) { if (idObject != NativeMethods.OBJID_WINDOW) { return; } if (!IsToolTip(hwnd)) { return; } // Raise ToolTipClosedEvent on OBJECT_HIDE WinEvents. Not raising the event for EVENT_OBJECT_DESTROY // because to do this means having to change code downstream from RaiseAutomationEvent to accept a // null src. PS #1007309 (Client-side proxies that raise events end up going through server-side // code) would be a good time to fix this issue (may then be able to pass null src). Most tool tips // currently get created, then shown and hidden, and are destroyed when the app exits so the impact // here should be minimal since the ToolTip is probaby not showing when the app exits. if (eventId == NativeMethods.EVENT_OBJECT_HIDE /*|| eventId == NativeMethods.EVENT_OBJECT_DESTROY*/) { WindowsTooltip wtv = new WindowsTooltip(hwnd, null, 0); AutomationEventArgs e = new AutomationEventArgs(AutomationElement.ToolTipClosedEvent); AutomationInteropProvider.RaiseAutomationEvent(AutomationElement.ToolTipClosedEvent, wtv, e); } }
// Static create method called by the event tracker system. // WinEvents are raised only when a notification has been set for a // specific item. internal static void RaiseEvents (IntPtr hwnd, int eventId, object idProp, int idObject, int idChild) { if (idObject != NativeMethods.OBJID_VSCROLL && idObject != NativeMethods.OBJID_HSCROLL) { WindowsTooltip wtv = new WindowsTooltip(hwnd, null, 0); wtv.DispatchEvents(eventId, idProp, idObject, idChild); } }
// Static create method called by the event tracker system. // WinEvents are raised only when a notification has been set for a // specific item. internal static void RaiseEvents(IntPtr hwnd, int eventId, object idProp, int idObject, int idChild) { if (idObject != NativeMethods.OBJID_VSCROLL && idObject != NativeMethods.OBJID_HSCROLL) { WindowsTooltip wtv = new WindowsTooltip(hwnd, null, 0); wtv.DispatchEvents(eventId, idProp, idObject, idChild); } }
//------------------------------------------------------ // // Private Methods // //------------------------------------------------------ #region Private Methods private static void OnToolTipEvents( IntPtr hwnd, int eventId, object idProp, int idObject, int idChild ) { if (idObject != NativeMethods.OBJID_WINDOW) { return; } if (!IsToolTip(hwnd)) { return; } // Raise ToolTipClosedEvent on OBJECT_HIDE WinEvents. Not raising the event for EVENT_OBJECT_DESTROY // because to do this means having to change code downstream from RaiseAutomationEvent to accept a // null src. PS #1007309 (Client-side proxies that raise events end up going through server-side // code) would be a good time to fix this issue (may then be able to pass null src). Most tool tips // currently get created, then shown and hidden, and are destroyed when the app exits so the impact // here should be minimal since the ToolTip is probaby not showing when the app exits. if( eventId == NativeMethods.EVENT_OBJECT_HIDE /*|| eventId == NativeMethods.EVENT_OBJECT_DESTROY*/ ) { WindowsTooltip wtv = new WindowsTooltip( hwnd, null, 0 ); AutomationEventArgs e = new AutomationEventArgs( AutomationElement.ToolTipClosedEvent ); AutomationInteropProvider.RaiseAutomationEvent( AutomationElement.ToolTipClosedEvent, wtv, e ); } }