Ejemplo n.º 1
0
        internal static SystemAccessibleObject GetAccessibleObject(AccessibleEventArgs e)
        {
            IAccessible iacc;
            object      child;
            uint        result = AccessibleObjectFromEvent(e.HWnd, e.ObjectID, e.ChildID, out iacc, out child);

            // Note: AccessibleObjectFromEvent() sometimes fails due to missing IAccessible implementation of object and/or child
            // This often happens for HTML content in Internet Explorer (e.g. for any <DIV> w/o 'role' attribute set).
            // Try again without using ChildID and/or ObjectID,
            // i.e. ChildID==0 will return the parent object; ObjectID==0 will return the parent window
            if (result != 0 && e.ChildID != 0)
            {
                // second chance: try to receive object instead of child
                result = AccessibleObjectFromEvent(e.HWnd, e.ObjectID, 0, out iacc, out child);
            }
            if (result != 0)
            {
                // third chance: try to receive window instead of object or child
                result = AccessibleObjectFromEvent(e.HWnd, 0, 0, out iacc, out child);
            }

            if (result != 0)
            {
                throw new Exception("AccessibleObjectFromPoint returned " + result);
            }
            return(new SystemAccessibleObject(iacc, (int)child));
        }
Ejemplo n.º 2
0
 private void listener_EventOccurred(object sender, ManagedWinapi.Accessibility.AccessibleEventArgs e)
 {
     if (nomouse.Checked && e.EventType == AccessibleEventType.EVENT_OBJECT_LOCATIONCHANGE && e.HWnd == IntPtr.Zero && e.ObjectID == (uint)AccessibleObjectID.OBJID_CURSOR)
     {
         return;
     }
     if (e.HWnd == clear.Handle || e.HWnd == skip.Handle || e.HWnd == list.Handle)
     {
         return;
     }
     if (skip.Checked)
     {
         skipped++;
         skip.Text = "Skip (" + skipped + ")";
     }
     else
     {
         ListViewItem lvi = new ListViewItem(new string[] { "" + (idx++), e.EventType.ToString(), "0x" + e.HWnd.ToString("x8"),
                                                            "0x" + e.ObjectID.ToString("x8"), "0x" + e.ChildID.ToString("x8"), "0x" + e.Thread.ToString("x8"),
                                                            e.Time.ToString() });
         lvi.Tag = e;
         list.Items.Add(lvi);
         lvi.EnsureVisible();
     }
 }
Ejemplo n.º 3
0
        internal static SystemAccessibleObject GetAccessibleObject(AccessibleEventArgs e)
        {
            IAccessible iacc;
            object      child;
            uint        result = AccessibleObjectFromEvent(e.HWnd, e.ObjectID, e.ChildID, out iacc, out child);

            if (result != 0)
            {
                throw new Exception("AccessibleObjectFromPoint returned " + result);
            }
            return(new SystemAccessibleObject(iacc, (int)child));
        }
Ejemplo n.º 4
0
        private void InternalCallback(IntPtr hWinEventHook, AccessibleEventType eventType,
                                      IntPtr hwnd, uint idObject, uint idChild, uint dwEventThread, uint dwmsEventTime)
        {
            if (hWinEventHook != handle)
            {
                return;
            }
            AccessibleEventArgs aea = new AccessibleEventArgs(eventType, hwnd, idObject, idChild, dwEventThread, dwmsEventTime);

            if (EventOccurred != null)
            {
                EventOccurred(this, aea);
            }
        }
Ejemplo n.º 5
0
        /// <summary>
        /// Handler for window move event
        /// </summary>
        /// <param name="sender">Object that raised the event</param>
        /// <param name="ea">Event arguments</param>
        private void OnWindowMoveHandler(object sender, AccessibleEventArgs ea)
        {
            // Ignore events from cursor
            if (ea.ObjectID != 0)
            {
                return;
            }

            // Stop fallback strategy timer if enabled
            if (this.fallbackStrategyTimer.IsEnabled)
            {
                this.fallbackStrategyTimer.Stop();
            }

            // Invoke event handler
            if (this.ClientAreaChanged != null)
            {
                this.ClientAreaChanged(this, EventArgs.Empty);
            }
        }
Ejemplo n.º 6
0
 private void InternalCallback(IntPtr hWinEventHook, AccessibleEventType eventType,
     IntPtr hwnd, uint idObject, uint idChild, uint dwEventThread, uint dwmsEventTime)
 {
     if (hWinEventHook != handle) return;
     AccessibleEventArgs aea = new AccessibleEventArgs(eventType, hwnd, idObject, idChild, dwEventThread, dwmsEventTime);
     if (EventOccurred != null)
         EventOccurred(this, aea);
 }
Ejemplo n.º 7
0
        internal static SystemAccessibleObject GetAccessibleObject(AccessibleEventArgs e)
        {
            IAccessible iacc;
            object child;
            uint result = AccessibleObjectFromEvent(e.HWnd, e.ObjectID, e.ChildID, out iacc, out child);

            // Note: AccessibleObjectFromEvent() sometimes fails due to missing IAccessible implementation of object and/or child
            // This often happens for HTML content in Internet Explorer (e.g. for any <DIV> w/o 'role' attribute set).
            // Try again without using ChildID and/or ObjectID,
            // i.e. ChildID==0 will return the parent object; ObjectID==0 will return the parent window
            if (result != 0 && e.ChildID != 0)
                // second chance: try to receive object instead of child
                result = AccessibleObjectFromEvent(e.HWnd, e.ObjectID, 0, out iacc, out child);
            if (result != 0)
                // third chance: try to receive window instead of object or child
                result = AccessibleObjectFromEvent(e.HWnd, 0, 0, out iacc, out child);

            if (result != 0) throw new Exception("AccessibleObjectFromPoint returned " + result);
            return new SystemAccessibleObject(iacc, (int)child);
        }
 internal static SystemAccessibleObject GetAccessibleObject(AccessibleEventArgs e)
 {
     IAccessible iacc;
     object child;
     uint result = AccessibleObjectFromEvent(e.HWnd, e.ObjectID, e.ChildID, out iacc, out child);
     if (result != 0) throw new Exception("AccessibleObjectFromPoint returned " + result);
     return new SystemAccessibleObject(iacc, (int)child);
 }