Exemplo n.º 1
0
        public IEAccessible(IntPtr ieHandle, int tabIndexToActivate)
        {
            AccessibleObjectFromWindow(GetDirectUIHWND(ieHandle), OBJID.OBJID_WINDOW, ref accessible);
            if (accessible == null)
                throw new Exception();

            var index = 0;
            var ieDirectUIHWND = new IEAccessible(ieHandle);

            foreach (IEAccessible accessor in ieDirectUIHWND.Children)
            {
                foreach (var child in accessor.Children)
                {
                    foreach (var tab in child.Children)
                    {
                        if (tabIndexToActivate >= child.ChildCount - 1) return;
                        if (index == tabIndexToActivate)
                        {
                            tab.Activate();
                            return;
                        }
                        index++;
                    }
                }
            }
        }
Exemplo n.º 2
0
        public void ActivateTab(IntPtr ieHandle, string tabCaptionToActivate)
        {
            AccessibleObjectFromWindow(GetDirectUIHWND(ieHandle), OBJID.OBJID_WINDOW, ref accessible);
            if (accessible == null)
            {
                throw new Exception();
            }

            var ieDirectUIHWND = new IEAccessible(ieHandle);

            foreach (IEAccessible accessor in ieDirectUIHWND.Children)
            {
                foreach (var child in accessor.Children)
                {
                    foreach (var tab in child.Children)
                    {
                        if (tab.Name == tabCaptionToActivate)
                        {
                            tab.Activate();
                            return;
                        }
                    }
                }
            }
        }
Exemplo n.º 3
0
        public List <string> GetTabCaptions(IntPtr ieHandle)
        {
            AccessibleObjectFromWindow(GetDirectUIHWND(ieHandle), OBJID.OBJID_WINDOW, ref accessible);
            if (accessible == null)
            {
                throw new Exception();
            }

            var ieDirectUIHWND = new IEAccessible(ieHandle);

            var captionList = new List <string>();

            foreach (IEAccessible accessor in ieDirectUIHWND.Children)
            {
                foreach (var child in accessor.Children)
                {
                    foreach (var tab in child.Children)
                    {
                        captionList.Add(tab.Name);
                    }
                }
            }
            if (captionList.Count > 0)
            {
                captionList.RemoveAt(captionList.Count - 1);
            }

            return(captionList);
        }
Exemplo n.º 4
0
        public void CloseTab(IntPtr ieHandle, int tabIndexToClose)
        {
            AccessibleObjectFromWindow(GetDirectUIHWND(ieHandle), OBJID.OBJID_WINDOW, ref accessible);
            if (accessible == null)
            {
                throw new Exception();
            }

            var ieDirectUIHWND = new IEAccessible(ieHandle);

            foreach (IEAccessible accessor in ieDirectUIHWND.Children)
            {
                foreach (var child in accessor.Children)
                {
                    foreach (var tab in child.Children)
                    {
                        object tabIndex = tab.accessible.get_accState(0);

                        if ((int)tabIndex == tabIndexToClose)
                        {
                            foreach (var CloseTab in tab.Children)
                            {
                                CloseTab.Activate();
                            }
                            return;
                        }
                    }
                }
            }
        }
Exemplo n.º 5
0
        public List <string> GetTabUrls(IntPtr ieHandle)
        {
            AccessibleObjectFromWindow(GetDirectUIHWND(ieHandle), OBJID.OBJID_WINDOW, ref accessible);
            if (accessible == null)
            {
                throw new Exception();
            }

            var ieDirectUIHWND = new IEAccessible(ieHandle);

            var urlList = new List <string>();

            foreach (IEAccessible accessor in ieDirectUIHWND.Children)
            {
                foreach (var child in accessor.Children)
                {
                    foreach (var tab in child.Children)
                    {
                        var description = tab.accessible.get_accDescription(CHILDID_SELF);
                        if (!string.IsNullOrEmpty(description))
                        {
                            if (description.Contains(Environment.NewLine))
                            {
                                var url = description.Substring(description.IndexOf(Environment.NewLine)).Trim();
                                urlList.Add(url);
                            }
                        }
                    }
                }
            }
            //if (urlList.Count > 0)
            //    urlList.RemoveAt(urlList.Count - 1);

            return(urlList);
        }
Exemplo n.º 6
0
        public string GetActiveTabCaption(IntPtr ieHandle)
        {
            AccessibleObjectFromWindow(GetDirectUIHWND(ieHandle), OBJID.OBJID_WINDOW, ref accessible);
            if (accessible == null)
            {
                throw new Exception();
            }

            var ieDirectUIHWND = new IEAccessible(ieHandle);

            foreach (IEAccessible accessor in ieDirectUIHWND.Children)
            {
                foreach (var child in accessor.Children)
                {
                    foreach (var tab in child.Children)
                    {
                        object tabIndex = tab.accessible.get_accState(0);

                        if ((int)tabIndex == IE_ACTIVE_TAB)
                        {
                            return(tab.Name);
                        }
                    }
                }
            }
            return(String.Empty);
        }
Exemplo n.º 7
0
        public IEAccessible(IntPtr ieHandle, int tabIndexToActivate)
        {
            AccessibleObjectFromWindow(GetDirectUIHWND(ieHandle), OBJID.OBJID_WINDOW, ref accessible);
            if (accessible == null)
            {
                throw new Exception();
            }

            var index          = 0;
            var ieDirectUIHWND = new IEAccessible(ieHandle);

            foreach (IEAccessible accessor in ieDirectUIHWND.Children)
            {
                foreach (var child in accessor.Children)
                {
                    foreach (var tab in child.Children)
                    {
                        if (tabIndexToActivate >= child.ChildCount - 1)
                        {
                            return;
                        }
                        if (index == tabIndexToActivate)
                        {
                            tab.Activate();
                            return;
                        }
                        index++;
                    }
                }
            }
        }
Exemplo n.º 8
0
        public int GetTabCount(IntPtr ieHandle)
        {
            AccessibleObjectFromWindow(GetDirectUIHWND(ieHandle), OBJID.OBJID_WINDOW, ref accessible);
            if (accessible == null)
            {
                throw new Exception();
            }

            var ieDirectUIHWND = new IEAccessible(ieHandle);

            foreach (IEAccessible accessor in ieDirectUIHWND.Children)
            {
                foreach (var child in accessor.Children)
                {
                    foreach (var tab in child.Children)
                    {
                        return(child.ChildCount - 1);
                    }
                }
            }
            return(0);
        }
Exemplo n.º 9
0
        public IEAccessible(IntPtr ieHandle, string tabCaptionToActivate)
        {
            AccessibleObjectFromWindow(GetDirectUIHWND(ieHandle), OBJID.OBJID_WINDOW, ref accessible);
            if (accessible == null)
                throw new Exception();

            var ieDirectUIHWND = new IEAccessible(ieHandle);

            foreach (IEAccessible accessor in ieDirectUIHWND.Children)
            {
                foreach (var child in accessor.Children)
                {
                    foreach (var tab in child.Children)
                    {
                        if (tab.Name == tabCaptionToActivate)
                        {
                            tab.Activate();
                            return;
                        }
                    }
                }
            }
        }
Exemplo n.º 10
0
        public string GetActiveTabUrl(IntPtr ieHandle)
        {
            AccessibleObjectFromWindow(GetDirectUIHWND(ieHandle), OBJID.OBJID_WINDOW, ref accessible);
            if (accessible == null)
            {
                throw new Exception();
            }

            var ieDirectUIHWND = new IEAccessible(ieHandle);

            foreach (IEAccessible accessor in ieDirectUIHWND.Children)
            {
                foreach (var child in accessor.Children)
                {
                    foreach (var tab in child.Children)
                    {
                        object tabIndex = tab.accessible.get_accState(CHILDID_SELF);

                        if ((int)tabIndex == IE_ACTIVE_TAB)
                        {
                            var description = tab.accessible.get_accDescription(CHILDID_SELF);

                            if (!string.IsNullOrEmpty(description))
                            {
                                if (description.Contains(Environment.NewLine))
                                {
                                    var url = description.Substring(description.IndexOf(Environment.NewLine)).Trim();
                                    return(url);
                                }
                            }
                        }
                    }
                }
            }

            return(String.Empty);
        }
Exemplo n.º 11
0
        public List<string> GetTabUrls(IntPtr ieHandle)
        {
            AccessibleObjectFromWindow(GetDirectUIHWND(ieHandle), OBJID.OBJID_WINDOW, ref accessible);
            if (accessible == null)
                throw new Exception();

            var ieDirectUIHWND = new IEAccessible(ieHandle);

            var urlList = new List<string>();

            foreach (IEAccessible accessor in ieDirectUIHWND.Children)
            {
                foreach (var child in accessor.Children)
                    foreach (var tab in child.Children)
                    {
                        var description = tab.accessible.get_accDescription(CHILDID_SELF);
                        if (!string.IsNullOrEmpty(description))
                        {
                            if (description.Contains(Environment.NewLine))
                            {
                                var url = description.Substring(description.IndexOf(Environment.NewLine)).Trim();
                                urlList.Add(url);
                            }
                        }
                    }
            }
            //if (urlList.Count > 0)
            //    urlList.RemoveAt(urlList.Count - 1);

            return urlList;
        }
Exemplo n.º 12
0
        public int GetTabCount(IntPtr ieHandle)
        {
            AccessibleObjectFromWindow(GetDirectUIHWND(ieHandle), OBJID.OBJID_WINDOW, ref accessible);
            if (accessible == null)
                throw new Exception();

            var ieDirectUIHWND = new IEAccessible(ieHandle);

            foreach (IEAccessible accessor in ieDirectUIHWND.Children)
            {
                foreach (var child in accessor.Children)
                {
                    foreach (var tab in child.Children)
                        return child.ChildCount - 1;
                }
            }
            return 0;
        }
Exemplo n.º 13
0
        public List<string> GetTabCaptions(IntPtr ieHandle)
        {
            AccessibleObjectFromWindow(GetDirectUIHWND(ieHandle), OBJID.OBJID_WINDOW, ref accessible);
            if (accessible == null)
                throw new Exception();

            var ieDirectUIHWND = new IEAccessible(ieHandle);

            var captionList = new List<string>();

            foreach (IEAccessible accessor in ieDirectUIHWND.Children)
            {
                foreach (var child in accessor.Children)
                    foreach (var tab in child.Children)
                        captionList.Add(tab.Name);

            }
            if (captionList.Count > 0)
                captionList.RemoveAt(captionList.Count - 1);

            return captionList;
        }
Exemplo n.º 14
0
        public string GetActiveTabUrl(IntPtr ieHandle)
        {
            AccessibleObjectFromWindow(GetDirectUIHWND(ieHandle), OBJID.OBJID_WINDOW, ref accessible);
            if (accessible == null)
                throw new Exception();

            var ieDirectUIHWND = new IEAccessible(ieHandle);

            foreach (IEAccessible accessor in ieDirectUIHWND.Children)
            {
                foreach (var child in accessor.Children)
                {
                    foreach (var tab in child.Children)
                    {
                        object tabIndex = tab.accessible.get_accState(CHILDID_SELF);

                        if ((int)tabIndex == IE_ACTIVE_TAB)
                        {
                            var description = tab.accessible.get_accDescription(CHILDID_SELF);

                            if (!string.IsNullOrEmpty(description))
                            {
                                if (description.Contains(Environment.NewLine))
                                {
                                    var url = description.Substring(description.IndexOf(Environment.NewLine)).Trim();
                                    return url;
                                }
                            }
                        }
                    }
                }
            }

            return String.Empty;
        }
Exemplo n.º 15
0
        public int GetActiveTabIndex(IntPtr ieHandle)
        {
            AccessibleObjectFromWindow(GetDirectUIHWND(ieHandle), OBJID.OBJID_WINDOW, ref accessible);
            if (accessible == null)
                throw new Exception();

            var index = 0;
            var ieDirectUIHWND = new IEAccessible(ieHandle);

            foreach (IEAccessible accessor in ieDirectUIHWND.Children)
            {
                foreach (var child in accessor.Children)
                {
                    foreach (var tab in child.Children)
                    {
                        object tabIndex = tab.accessible.get_accState(0);

                        if ((int)tabIndex == IE_ACTIVE_TAB)
                            return index;

                        index++;
                    }
                }
            }

            return -1;
        }
Exemplo n.º 16
0
        public void CloseTab(IntPtr ieHandle, int tabIndexToClose)
        {
            AccessibleObjectFromWindow(GetDirectUIHWND(ieHandle), OBJID.OBJID_WINDOW, ref accessible);
            if (accessible == null)
                throw new Exception();

            var ieDirectUIHWND = new IEAccessible(ieHandle);

            foreach (IEAccessible accessor in ieDirectUIHWND.Children)
            {
                foreach (var child in accessor.Children)
                {
                    foreach (var tab in child.Children)
                    {
                        object tabIndex = tab.accessible.get_accState(0);

                        if ((int)tabIndex == tabIndexToClose)
                        {
                            foreach (var CloseTab in tab.Children)
                                CloseTab.Activate();
                            return;
                        }
                    }
                }
            }
        }