コード例 #1
0
        public List <MSAAUIItem> GetChildren()
        {
            List <MSAAUIItem> accUiItemList = new List <MSAAUIItem>();

            foreach (IAccessible accUIObject in MSAA.GetAccessibleChildren(_me))
            {
                MSAAUIItem accUIItem = new MSAAUIItem(accUIObject);
                accUiItemList.Add(accUIItem);
            }

            return(accUiItemList);
        }
コード例 #2
0
        private void SetAccessibleProperties()
        {
            //Here we are consuming the COM Exceptions which happens in case
            //the property/Method we need is not available with IAccessible Object.

            try
            {
                _name = _accessible.get_accName(0);
            }
            catch (Exception ex)
            {
            }

            try
            {
                _value = _accessible.get_accValue(0);
            }
            catch (Exception ex)
            {
            }

            try
            {
                uint stateId = Convert.ToUInt32(_accessible.get_accState(0));
                _state = MSAA.GetStateText(stateId);
            }
            catch (Exception ex)
            {
            }

            try
            {
                uint roleId = Convert.ToUInt32(_accessible.get_accRole(0));
                _role = MSAA.GetRoleText(roleId);
            }
            catch (Exception ex)
            {
            }


            _handle = MSAA.GetHandle(_accessible);

            try
            {
                _defaultAction = _accessible.get_accDefaultAction(0);
            }
            catch (Exception ex)
            {
            }

            SetLocation(_accessible);
        }
コード例 #3
0
        public List <MSAAUIItem> GetChildren(AccessibleUIItemType uiItemType)
        {
            List <MSAAUIItem> accUiItemList = new List <MSAAUIItem>();

            foreach (IAccessible accUIObject in MSAA.GetAccessibleChildren(_me))
            {
                MSAAUIItem accUIItem = new MSAAUIItem(accUIObject);

                if (accUIItem.Properties.Role == MSAARoles.GetRoleText(uiItemType))
                {
                    accUiItemList.Add(accUIItem);
                }
            }

            return(accUiItemList);
        }
コード例 #4
0
        public MSAAUIItem(string className, string caption)
        {
            for (int searchCycleCount = 0; searchCycleCount < searchCycles; searchCycleCount++)
            {
                _me = MSAA.GetTopWindowAccessibleObject(className, caption);

                if (_me == null || _me == default(IAccessible))
                {
                    Thread.Sleep(searchDuration);
                }
                else
                {
                    _propertySet = new MSAAPropertySet(_me);
                    break;
                }
            }
        }
コード例 #5
0
        public MSAAUIItem(IAccessible parentAccObject, Regex name, bool ignoreInvisible)
        {
            for (int searchCycleCount = 0; searchCycleCount < searchCycles; searchCycleCount++)
            {
                _me     = MSAA.GetObjectByName(parentAccObject, name, ignoreInvisible);
                _parent = parentAccObject;

                if (_me == null || _me == default(IAccessible))
                {
                    Thread.Sleep(searchDuration);
                }
                else
                {
                    _propertySet = new MSAAPropertySet(_me);
                    break;
                }
            }
        }
コード例 #6
0
        public static List <MSAAUIItem> GetAllUIItemsOfType(AccessibleUIItemType uiItemType, bool ignoreInvisible)
        {
            List <MSAAUIItem> accUiItemList = new List <MSAAUIItem>();

            var accObjectList = new List <IAccessible>();

            MSAA.GetAccessibleObjectListByRole(_me, MSAARoles.GetRoleText(uiItemType), ref accObjectList, ignoreInvisible);

            foreach (IAccessible accUIObject in accObjectList)
            {
                MSAAUIItem accUIItem = new MSAAUIItem(accUIObject);

                if (accUIItem.Properties.Role == MSAARoles.GetRoleText(uiItemType))
                {
                    accUiItemList.Add(accUIItem);
                }
            }

            return(accUiItemList);
        }