public bool checkHandle()
        {
            Guid guid = new Guid("{618736E0-3C3D-11CF-810C-00AA00389B71}");
            object obj = null;
            int retVal = AccessibleObjectFromWindow(handle, (uint)OBJID.WINDOW, ref guid, ref obj);
            iAccessible = (IAccessible)obj;

            //The AccWindowName returned is Add-ons Manager - Mozilla Firefox
            //There is a special child id called CHILDID_SELF (this constant equals 0) that, when used with a function like get_accChild, returns the element itself rather than a child.

            string accWindowName = iAccessible.get_accName(0);
            string accWindowVal = iAccessible.get_accValue(0);

            Console.WriteLine("IAccessible Name : " + accWindowName);
            Console.WriteLine("IAccessible value : " + accWindowVal);
            Console.WriteLine("IAccessible Role is : " + iAccessible.get_accRole(0));

            Console.WriteLine("IAccessible Type: " + iAccessible.GetType());
            Console.WriteLine("IAccessible Focus is: " + iAccessible.accFocus);
            Console.WriteLine("IAccessible Selection is " + iAccessible.get_accState());
            //iAccessible.accSelect((int)OBJID.SELFLAG_TAKEFOCUS, 0);
            if (!accWindowName.Contains("Mozilla Firefox"))
                return false;

            getChild(iAccessible,false);

            //End of for window
            Console.WriteLine("End of checkHandle");
            iAccessible = null;
            return false;
        }
 internal InternalAccessibleObject(AccessibleObject accessibleImplemention)
 {
     this.publicIAccessible = accessibleImplemention;
     this.publicIEnumVariant = accessibleImplemention;
     this.publicIOleWindow = accessibleImplemention;
     this.publicIReflect = accessibleImplemention;
 }
 public static void AddValues(List<KeyValuePair<string,string>> values, IAccessible accObj)
 {
     string name = accObj.accName;
      object value = accObj.accValue ?? accObj.accName ?? accObj.accDescription ?? accObj.accRole ?? accObj.accState;
      if (value != null)
     values.Add(new KeyValuePair<string, string>(name, value as string ?? "<non string>"));
      int count;
      object [] myList = new object[100];
      AccessibleChildren(accObj, 0, myList.Length, myList, out count);
      foreach (var c in myList)
      {
     if (c == null)
        continue;
     var child = c as IAccessible;
     if (child == null)
        continue;
     try
     {
        AddValues(values, child);
     }
     catch (Exception e)
     {
        Console.Error.WriteLine(e);
     }
      }
 }
 private Accessible(IAccessible acc)
 {
     if (acc == null) {
         throw new Exception();
     }
     accessible = acc;
 }
Exemple #5
0
		private static int AccessibleObjectFromWindow(IntPtr hWnd, OBJID idObject, ref IAccessible acc) {
			Guid guid = new Guid("{618736e0-3c3d-11cf-810c-00aa00389b71}"); // IAccessible
			object obj = null;
			int num = AccessibleObjectFromWindow(hWnd, (uint)idObject, ref guid, ref obj);
			acc = (IAccessible)obj;
			return num;
		}
Exemple #6
0
 bool IsGridRole(IAccessible instance)
 {
     try {
         AccessibleRole role = (AccessibleRole)instance.accRole;
         return(role == AccessibleRole.Cell || role == AccessibleRole.Row || role == AccessibleRole.RowHeader || role == AccessibleRole.Column || role == AccessibleRole.ColumnHeader);
     }
     catch {
         return(false);
     }
 }
Exemple #7
0
        internal static IntPtr GetWindowFromIAccessible(IAccessible accObj)
        {
            IntPtr zero = IntPtr.Zero;

            if (accObj != null)
            {
                OleAccNativeMethods.WindowFromAccessibleObject(accObj, out zero);
            }
            return(zero);
        }
Exemple #8
0
        internal static string GetRole(IAccessible accObj, int childId)
        {
            int roleId = GetRoleId(accObj, childId);

            if (roleId < 0)
            {
                return(string.Empty);
            }
            return(GetRoleText((uint)roleId));
        }
Exemple #9
0
        internal static Rectangle GetRelAccLocation(IAccessible accObj, int childId)
        {
            IntPtr windowFromIAccessible = GetWindowFromIAccessible(accObj);
            LPRECT lpRect = new LPRECT();

            Win32NativeMethods.GetWindowRect(windowFromIAccessible, ref lpRect);
            Rectangle accLocation = GetAccLocation(accObj, childId);

            return(new Rectangle(lpRect.Left - accLocation.X, lpRect.Top - accLocation.Y, accLocation.Width, accLocation.Height));
        }
Exemple #10
0
        internal static IAccessible GetIAccessibleFromWindow(IntPtr hWnd)
        {
            IAccessible ppvObject = null;

            if (!hWnd.Equals(IntPtr.Zero))
            {
                OleAccNativeMethods.AccessibleObjectFromWindow(hWnd, OleAccObjectId.OBJID_CLIENT, ref OleAccNativeMethods.IID_IAccessible, ref ppvObject);
            }
            return(ppvObject);
        }
Exemple #11
0
        private TabActivator(IAccessible acc)

        {
            if (acc == null)
            {
                throw new Exception("Could not get accessible");
            }

            _accessible = acc;
        }
        protected override string GetDocumentTitle(IAccessible document)
        {
            var firstChild = AccessibleObjectHelper.GetChildren(document).FirstOrDefault();

            if (firstChild != null)
            {
                return(firstChild.accName[0]);
            }
            return(null);
        }
Exemple #13
0
        private static int AccessibleObjectFromWindow(IntPtr hwnd, OBJID idObject, ref IAccessible acc)
        {
            Guid guid = new Guid("{618736e0-3c3d-11cf-810c-00aa00389b71}"); // IAccessible

            object obj = null;
            int    num = AccessibleObjectFromWindow(hwnd, (uint)idObject, ref guid, ref obj);

            acc = (IAccessible)obj;
            return(num);
        }
        // Overload for IAccessibles, much user friendly.
        internal static int AccessibleObjectFromWindow(IntPtr hwnd, uint idObject, ref IAccessible acc)
        {
            Guid IID_IUnknown = new Guid(0x00000000, 0x0000, 0x0000, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46);

            object obj = null;
            int    hr  = AccessibleObjectFromWindow(hwnd, idObject, ref IID_IUnknown, ref obj);

            acc = (IAccessible)obj;
            return(hr);
        }
        public override FocusType GetFocusType(IAccessible accessibleObject, out string url)
        {
            url = null;

            // Walk up tree finding parent
            var parent = accessibleObject;

            while (parent != null)
            {
                var role = AccessibleObjectHelper.GetRole(parent);
                if (role == AccessibleRole.ToolBar)
                {
                    // This is on the toolbar, so either location box or search box
                    if (accessibleObject.accParent is IAccessible immediateParent)
                    {
                        if (AccessibleObjectHelper.GetRole(immediateParent) == AccessibleRole.ComboBox)
                        {
                            if (AccessibleObjectHelper.HasState(accessibleObject, AccessibleStates.HasPopup))
                            {
                                return(FocusType.Location);
                            }
                            else
                            {
                                return(FocusType.Search);
                            }
                        }
                        else
                        {
                            if (parent.accParent is IAccessible propertyPage &&
                                AccessibleObjectHelper.GetRole(propertyPage) == AccessibleRole.PropertyPage)
                            {
                                // Get URL for page
                                var document = AccessibleObjectHelper.FindChild(AccessibleObjectHelper.FindChild(propertyPage),
                                                                                role: AccessibleRole.Document);
                                if (document != null)
                                {
                                    url = AccessibleObjectHelper.GetValue(document);
                                }
                            }

                            return(FocusType.FindInPage);
                        }
                    }
                }
                else if (role == AccessibleRole.Document && AccessibleObjectHelper.HasState(accessibleObject, AccessibleStates.Focusable))
                {
                    // This is a web page
                    url = AccessibleObjectHelper.GetValue(parent);
                    return(FocusType.Page);
                }
                parent = parent.accParent as IAccessible;
            }

            return(FocusType.Other);
        }
 /// <summary>
 /// 获取子对象
 /// 获取倒数第二级的子对象时会返回 (int32)1 ???
 /// </summary>
 /// <param name="target"></param>
 /// <returns></returns>
 public static IAccessible[] GetChildren(this IAccessible target)
 {
     Console.WriteLine($"获取对象 {target.GetHashCode().ToString("X")} 的子对象集合...");
     try
     {
         IAccessible[] Children = new IAccessible[target.accChildCount];
         AccessibleChildren(target, 0, target.accChildCount, Children, out int pcObtained);
         return(Children);
     }
     catch { return(null); }
 }
 public static string SafeGetName(IAccessible accessibleObject)
 {
     try
     {
         return(accessibleObject.accName[0]);
     }
     catch (Exception)
     {
         return(null);
     }
 }
Exemple #18
0
        public void UpdateState()
        {
            object state = IAccessible.get_accState(ChildId);

            if (!(state is int))
            {
                throw new VariantNotIntException(state);
            }

            State = (int)state;
        }
Exemple #19
0
        public void UpdateValue()
        {
            string value = IAccessible.get_accValue(ChildId);

            if (value == null)
            {
                value = "";
            }

            Value = value;
        }
Exemple #20
0
        internal static string BuildIAccessibleKey(IAccessible accObj, int childId)
        {
            StringBuilder builder = new StringBuilder();
            IntPtr        windowFromIAccessible = GetWindowFromIAccessible(accObj);

            builder.AppendFormat(CultureInfo.InvariantCulture, "{0}.{1}.{2}.{3:X8}", new object[] { GetRoleId(accObj, childId), childId, GetName(accObj, childId), windowFromIAccessible.ToInt32() });
            Rectangle relAccLocation = GetRelAccLocation(accObj, childId);

            builder.AppendFormat(CultureInfo.InvariantCulture, ".{0},{1},{2},{3}", new object[] { relAccLocation.X, relAccLocation.Y, relAccLocation.Width, relAccLocation.Height });
            return(builder.ToString());
        }
Exemple #21
0
 public static string GetValue(IAccessible accessibleObject)
 {
     try
     {
         return(accessibleObject.accValue[0]);
     }
     catch (Exception)
     {
         return(null);
     }
 }
Exemple #22
0
        private void GetAccessibleObjects(System.IntPtr imWindowHwnd, out IAccessible inputBox)
        {
            Guid guidCOM = new Guid(0x618736E0, 0x3C3D, 0x11CF, 0x81, 0xC, 0x0, 0xAA, 0x0, 0x38, 0x9B, 0x71);

            Accessibility.IAccessible IACurrent = null;

            Win32.AccessibleObjectFromWindow(imWindowHwnd, (int)Win32.OBJID_CLIENT, ref guidCOM, ref IACurrent);
            IACurrent = (IAccessible)IACurrent.accParent;
            inputBox  = null;
            inputBox  = GetMsgChild(IACurrent);
        }
Exemple #23
0
        private static void LogAccessibleObject(int depth, IntPtr hWnd, IAccessible child)
        {
            sFile.Write(new String(' ', depth));
            string value;

            try
            {
                value = child.accValue[0];
            }
            catch (Exception)
            {
                value = "";
            }

            string roleString;

            try
            {
                roleString = child.accRole[0] as string;

                if (child.accRole[0] is int)
                {
                    roleString = Enum.GetName(typeof(AccessibleRole), (int)child.accRole[0]);
                }
            }
            catch (NullReferenceException)
            {
                roleString = "<undefined role>";
            }

            int left, width, top, height;

            try
            {
                child.accLocation(out left, out top, out width, out height);
            }
            catch (Exception)
            {
                left = width = top = height = -1;
            }

            string name;

            try
            {
                name = child.accName[0];
            }
            catch (NullReferenceException)
            {
                name = "<no name>";
            }

            sFile.WriteLine("{0}[{1}]:{2}={3}, Role:{4}, State:{5}, Pos:{6},{7}", hWnd.ToString("X"), GetClassName(hWnd), name, value, roleString, child.accState[0], left, top);
        }
 /// <summary>
 /// 获取指定ID的子对象
 /// 获取倒数第二级的子对象时会返回 (int32)1 ???
 /// </summary>
 /// <param name="target"></param>
 /// <param name="ChildID">子对象的ID</param>
 /// <returns></returns>
 public static IAccessible GetChild(this IAccessible target, int ChildID)
 {
     Console.WriteLine($"获取对象 {target.GetHashCode().ToString("X")} 指定 ID= {ChildID} 的子对象...");
     try
     {
         IAccessible[] Children = new IAccessible[target.accChildCount];
         AccessibleChildren(target, ChildID, 1, Children, out int pcObtained);
         return(Children.FirstOrDefault());
     }
     catch { return(null); }
 }
Exemple #25
0
 public static AccessibleRole GetRole(IAccessible accessibleObject)
 {
     try
     {
         return((AccessibleRole)accessibleObject.accRole[0]);
     }
     catch (Exception)
     {
         return(AccessibleRole.None);
     }
 }
Exemple #26
0
        /// <summary>
        /// Gets the child accessible object by name and role text.
        /// </summary>
        /// <param name="accContainer">
        /// The container object's IAccessible interface.
        /// </param>
        /// <param name="name">The name of the object</param>
        /// <param name="roleText">The role text of the object</param>
        /// <param name="ignoreInvisible">
        /// Specifies if it's required to ignore the invisible objects.
        /// </param>
        /// <returns>
        /// The accessible object in the container that match the specified name
        /// and role.
        /// </returns>
        public static IAccessible GetAccessibleObjectByNameAndRole(
            IAccessible accContainer, Regex name, string roleText,
            bool ignoreInvisible)
        {
            IAccessible objToReturn = null;

            if (accContainer != null)
            {
                // Get the child accessible objects.
                IAccessible[] children = GetAccessibleChildren(accContainer);
                foreach (IAccessible child in children)
                {
                    string childName  = null;
                    string childState = string.Empty;
                    string childRole  = string.Empty;
                    try
                    {
                        childName  = child.get_accName(0);
                        childState = GetStateText((MSAAStateConstants)child.get_accState(0));
                        childRole  = GetRoleText(Convert.ToUInt32(child.get_accRole(0)));
                    }
                    catch (Exception ex)
                    {
                        // Record the error and continue.
                        Debug.Print(ex.Message);
                        continue;
                    }

                    // If the child is invisible and it's required to ignore the
                    // invisible objects, continue to the next object.
                    if (ignoreInvisible && childState.Contains("invisible"))
                    {
                        continue;
                    }

                    // If the name and role match, return the object.
                    if (!string.IsNullOrEmpty(childName) &&
                        name.Match(childName).Success&&
                        childRole == roleText)
                    {
                        return(child);
                    }

                    // Recursively look for the object among the children.
                    objToReturn = GetAccessibleObjectByNameAndRole(child, name,
                                                                   roleText, ignoreInvisible);
                    if (objToReturn != null)
                    {
                        return(objToReturn);
                    }
                }
            }
            return(objToReturn);
        }
Exemple #27
0
 public static bool HasState(IAccessible accessibleObject, AccessibleStates state)
 {
     try
     {
         return(((AccessibleStates)accessibleObject.accState[0] & state) != 0);
     }
     catch (Exception)
     {
         return(false);
     }
 }
Exemple #28
0
        public void UpdateRole()
        {
            object role = IAccessible.get_accRole(ChildId);

            if (!(role is int))
            {
                throw new VariantNotIntException(role);
            }

            Role = (int)role;
        }
Exemple #29
0
        private object[] GetAccessibleChildren(IAccessible paccContainer)
        {
            if (paccContainer == null)
            {
                return(new object[] { });
            }
            object[] rgvarChildren = new object[paccContainer.accChildCount];
            int      pcObtained;

            Win32.AccessibleChildren(paccContainer, 0, paccContainer.accChildCount, rgvarChildren, out pcObtained);
            return(rgvarChildren);
        }
Exemple #30
0
        /// <summary>
        /// Gets the IAccessible from the given window handle.
        /// </summary>
        /// <param name="windowHandle">The window handle.</param>
        /// <returns>The IAccessible object.</returns>
        internal static IAccessible AccessibleObjectFromWindow(IntPtr windowHandle)
        {
            Guid        accessibleGuid = typeof(IAccessible).GUID;
            IAccessible accessible     = null;

            if (AccessibleObjectFromWindow(windowHandle, 0, ref accessibleGuid, ref accessible) != 0)
            {
                Trace.WriteLine(string.Format(CultureInfo.InvariantCulture, "AccessibleObjectFromWindow for handle {0} Writelineed", windowHandle));
            }

            return(accessible);
        }
        internal static List<IAccessible> GetChildrenIacc(IAccessible oParent)
        {
            object[] objs = GetChildrenObjects(oParent);
            if (objs == null)
                return null;

            List<IAccessible> result = new List<IAccessible>();
            foreach (Object o in objs)
                if (o != null)
                    result.Add((IAccessible)o);
            return result;
        }
Exemple #32
0
        private static object[] GetAccessibleChildren(IAccessible Parent)
        {
            object[] Children = new Object[Parent.accChildCount];
            int      obtained = 0;

            if (NativeMethods.AccessibleChildren(Parent, 0, Parent.accChildCount, Children, out obtained) < 0)
            {
                throw new System.ComponentModel.Win32Exception(Marshal.GetLastWin32Error(), "Getting Accessible children failed.");
            }
            System.Diagnostics.Debug.WriteLine("number of accessible children: " + Children.Length);
            return(Children);
        }
Exemple #33
0
        //初期動作
        protected override void ControllerCreate(int hWnd)
        {
            YukarinetteLogger.Instance.Info("ControllerCreate : V2");

            IntPtr intPtr = new IntPtr(hWnd);
            Guid   guid   = new Guid("{618736e0-3c3d-11cf-810c-00aa00389b71}");
            object obj    = null;

            AccessibleObjectFromWindow(intPtr, 0u, ref guid, ref obj);

            Accessible = (IAccessible)obj;
        }
        private static List <IAccessible> AccChildren(IAccessible accessible)
        {
            var res  = GetAccessibleChildren(accessible, out int _);
            var list = new List <IAccessible>();

            if (res == null)
            {
                return(list);
            }
            list.AddRange(res.OfType <IAccessible>());
            return(list);
        }
        /// <summary>
        /// Finds the child by navigating into the logical hierarchy
        /// </summary>
        /// <param name="paccParent">Parent window as IAccessible</param>
        /// <param name="childId">ID of child window</param>
        /// <param name="childWindow">Child window description</param>
        /// <param name="ppaccChild">Child as IAccessible</param>
        /// <param name="foundId">ID found for child</param>
        /// <returns>flag if child found</returns>
        public static bool FindChild(IAccessible paccParent, int childId, PopupBasherConfiguration.PopupConfigChild childWindow, out IAccessible ppaccChild, out int foundId)
        {
            bool found = false;

            ppaccChild = null;
            foundId    = 0;

            try
            {
                // First check if the parent is the search item
                found = IsMatching(paccParent, childId, childWindow);
                if (found)
                {
                    ppaccChild = paccParent;
                    foundId    = childId;
                }
                else
                {
                    int      numChildren = paccParent.accChildCount;
                    object[] children    = new object[numChildren];
                    NativeMethods.AccessibleChildren(paccParent, 0, numChildren, children, out numChildren);

                    foreach (object child in children)
                    {
                        if (child is int)
                        {
                            // This is an element
                            found = IsMatching(paccParent, (int)child, childWindow);
                            if (found)
                            {
                                ppaccChild = paccParent;
                                foundId    = (int)child;
                            }
                        }
                        else if (child is IAccessible)
                        {
                            found = FindChild((IAccessible)child, 0, childWindow, out ppaccChild, out foundId);
                        }

                        if (found)
                        {
                            break;
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                Tracing.WriteDebugTextWarning(Tracing.ComponentId.ExcelDriver, ex.ToString());
            }

            return(found);
        }
Exemple #36
0
        public void ProgressBarAccessibilityObject_GetChildCount_ReturnsExpected()
        {
            using var ownerControl = new ProgressBar
                  {
                      Value = 5
                  };
            Control.ControlAccessibleObject accessibilityObject = Assert.IsAssignableFrom <Control.ControlAccessibleObject>(ownerControl.AccessibilityObject);
            IAccessible iAccessible = accessibilityObject;

            Assert.Equal(0, iAccessible.accChildCount);
            Assert.Equal(-1, accessibilityObject.GetChildCount());
        }
		static bool HasName(IAccessible accessible, string name)
		{
			try
			{
				if (!Marshal.IsComObject(accessible)) return false;

				return accessible.accName[0] == name;
			}
			catch
			{
				return false;
			}
		}
		static int GetChildCount(IAccessible accessible)
		{
			try
			{
				if (!Marshal.IsComObject(accessible)) return 0;

				return accessible.accChildCount;
			}
			catch
			{
				return 0;
			}
		}
        internal static object[] GetChildrenObjects(IAccessible oParent)
        {
            int lHowMany = oParent.accChildCount;

            if (lHowMany == 0)
                return null;

            object[] avKids = new object[lHowMany];
            int lGotHowMany = 0;

            if (OleAcc.AccessibleChildren(oParent, 0, lHowMany, avKids, out lGotHowMany) != 0)
                return null;
            return avKids;
        }
Exemple #40
0
 private static void DumpAccessible(IAccessible accessible, int indent)
 {
     Console.Write(new string(' ', indent) + "* ");
       Console.Write(accessible.GetNameSafe() ?? "<null name>");
       Console.Write('\t');
       Console.Write(accessible.GetRoleSafe());
       Console.Write('\t');
       Console.Write(accessible.GetValueAsString() ?? "<null value>");
       Console.Write('\t');
       Console.Write(accessible.GetStateSafe() ?? "<null state>");
       Console.Write('\t');
       Console.Write(accessible.GetDescriptionSafe() ?? "<null description>");
       Console.WriteLine();
 }
        private TabActivator(IAccessible acc)
        {
            if (acc == null)
                try
                {
                    throw new ExceptionHandler(ExceptionHandler.exIAccessible);
                }
                catch (ExceptionHandler exh)
                {

                    ExceptionHandler.WriteLog(exh);
                }

            _accessible = acc;
        }
Exemple #42
0
        public MSAAUIItem(Regex name)
        {
            for (int searchCycleCount = 0; searchCycleCount < searchCycles; searchCycleCount++)
            {
                _me = MSAA.GetTopWindowAccessibleObject(name);

                if (_me == null || _me == default(IAccessible))
                {
                    Thread.Sleep(searchDuration);
                }
                else
                {
                    _propertySet = new MSAAPropertySet(_me);
                    break;
                }
            }
        }
		public bool? IsReferencesTabSelected()
		{
			if (referencesTab == null)
			{
				//referencesTab = AddinModule.CurrentInstance.GetReferencesTabAccessible();
				referencesTab = AccessibleHelper.GetTabByName("References", AddinModule.CurrentInstance.WordApp);
			}

			if (referencesTab == null) return null;

			try
			{
				return ((int) referencesTab.accState[0] & 0x02) == 0x02;
			}
			catch
			{
				return null;
			}
		}
        // ------------------------------------------------------
        //
        //  Constructors
        //
        //------------------------------------------------------

        #region Constructors

        internal ListViewItemStartMenu(IntPtr hwnd, ProxyFragment parent, int item, IAccessible acc)
            : base (hwnd, parent, item)
        {
            // The items are zero based, i.e. the first listview item is item 0.  The
            // zero item in MSAA is self, so need to add one to the item to get the 
            // correct Accessible child.
            AccessibleRole role = Accessible.GetRole(acc, item + 1);

            // Normal Listview items should be of control type listitem.  But
            // the Listview items in the Start Menu act like menuitems.  Get the Role
            // from IAccessible interface implemented by the Shell team and set the
            // control type.
            if (role == AccessibleRole.MenuItem)
            {
                _cControlType = ControlType.MenuItem;
            }
            else
            {
                System.Diagnostics.Debug.Assert(false, "The listview item on the Start Menu has an unexpected IAccessible role!");
            }
        }
        internal static IAccessible FindFirstChildByName(IAccessible oParent, String strName)
        {
            List<IAccessible> avKids = GetChildrenIacc(oParent);

            if (avKids == null || avKids.Count == 0)
                return null;

            IAccessible result = null;
            foreach (IAccessible o in avKids)
            {
                if (o == null)
                    continue;
                if (String.Compare(o.accName, strName) == 0)
                    result = o;
                else
                    result = FindFirstChildByName(o, strName);

                if (result != null)
                    return result;
            }
            return null;
        }
		static void EnumerateChildren(IAccessible parent, Func<IAccessible[], bool> callback)
		{
			var childCount = GetChildCount(parent);
			if (childCount == 0) return;

			var children = new IAccessible[childCount];
			var obtainedCount = 0;

			AccessibleChildren(parent, 0, childCount, children, ref obtainedCount);

			if (callback(children))
			{
				for (var i = 0; i < children.Length; i++)
				{
					var child = children[i];
					if (!Marshal.IsComObject(child)) continue;

					EnumerateChildren(child, callback);

					Marshal.ReleaseComObject(child);
				}
			}
		}
Exemple #47
0
 public MSAAPropertySet(IAccessible accessibleObject)
 {
     _accessible = accessibleObject;
     
     if(_accessible != null && _accessible != default(IAccessible))
     {
         SetAccessibleProperties();
     }
 }
Exemple #48
0
 public MSAAUIItem(IAccessible accObject)
 {
     _me = accObject;
     _propertySet = new MSAAPropertySet(_me);
 }
Exemple #49
0
        public MSAAUIItem(IAccessible parentAccObject, Regex name, AccessibleUIItemType uiItemType, bool ignoreInvisible)
        {
            for (int searchCycleCount = 0; searchCycleCount < searchCycles; searchCycleCount++)
            {
                _me = MSAA.GetObjectByNameAndRole(parentAccObject, name, MSAARoles.GetRoleText(uiItemType), ignoreInvisible);
                _parent = parentAccObject;

                if (_me == null || _me == default(IAccessible))
                {
                    Thread.Sleep(searchDuration);
                }
                else
                {
                    _propertySet = new MSAAPropertySet(_me);
                    break;
                }
            }
            
            _propertySet = new MSAAPropertySet(_me);
        }
Exemple #50
0
 public static extern uint AccessibleObjectFromPoint(Point pt, out IAccessible oIAcc, ref object oChild);
Exemple #51
0
 public static extern IntPtr AccessibleObjectFromPoint(Point p,ref IAccessible ppvObject, out object pvarchild);
 private static extern int AccessibleChildren(IAccessible paccContainer, int iChildStart, int cChildren, [In, Out, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 2)] object[] rgvarChildren, out int pcObtained);
        private IEAccessible(IAccessible acc)
        {
            if (acc == null) throw new Exception();

            accessible = acc;
        }
Exemple #54
0
 public static extern object AccessibleObjectFromWindow(IntPtr hwnd, int dwObjectID, ref Guid riid, ref IAccessible ppvObject);
Exemple #55
0
 public static extern uint AccessibleObjectFromEvent(IntPtr hwnd, uint dwObjectID, uint dwChildID, out IAccessible iAccessible, [MarshalAs(UnmanagedType.Struct)] out object pvarChild);
Exemple #56
0
 public static extern uint WindowFromAccessibleObject(IAccessible pacc, ref IntPtr phwnd);
Exemple #57
0
        private void SetLocation(IAccessible accObject)
        {
            if (accObject != null)
            {
                int x1, y1;
                int width;
                int hieght;

                accObject.accLocation(out x1, out y1, out width, out hieght, 0);
                _location = new Rectangle(x1, y1, x1 + width, y1 + hieght);
            }
        }
        private static object[] GetAccessibleChildren(IAccessible ao, out int childs)
        {
            childs = 0;

            object[] ret = null;

            int count = ao.accChildCount;

            if (count > 0)
            {
                ret = new object[count];

                AccessibleChildren(ao, 0, count, ret, out childs);
            }

            return ret;
        }
Exemple #59
0
 public static extern int AccessibleChildren(IAccessible paccContainer, int iChildStart, int cChildren, [Out] object[] rgvarChildren, out int pcObtained);
Exemple #60
0
        private static extern int AccessibleObjectFromWindow(
			IntPtr hwnd,
			int id,
			ref Guid iid,
			ref IAccessible ppvObject);