private static bool doesIEWindowExist(int hwnd)
        {
            SHDocVw.ShellWindows sws = new SHDocVw.ShellWindows();
            for (int i = 0; i < sws.Count; i++)
            {
                SHDocVw.InternetExplorer ie = (SHDocVw.InternetExplorer)sws.Item(i);
                if (ie.HWND == hwnd)
                {
                    return(true);
                }
            }

            return(false);
        }
Example #2
0
        private void NavigateNewTab(string url)
        {
            InternetExplorer ie         = null;
            ShellWindows     allBrowser = new SHDocVw.ShellWindows();
            int browserCount            = allBrowser.Count - 1;

            while (browserCount >= 0)
            {
                ie = allBrowser.Item(browserCount) as InternetExplorer;
                if (ie != null && ie.FullName.ToLower().Contains("iexplore.exe"))
                {
                    ie.Navigate2(url, 0x1000);
                    break;
                }
                browserCount--;
            }

            this.Close();
        }
        /// <summary>
        /// If connection to existing Innovator is required then find the first IE window with the
        /// specified URL. Otherwise, create a new IE window.
        /// </summary>
        /// <returns></returns>
        private static InternetExplorer getIEHandle()
        {
            if (!NewIE)
            {
                SHDocVw.ShellWindows sws = new SHDocVw.ShellWindows();
                for (int i = 0; i < sws.Count; i++)
                {
                    SHDocVw.InternetExplorer ie = (SHDocVw.InternetExplorer)sws.Item(i);
                    int h = ie.HWND;
                    if (ie.LocationURL.Length >= InnovatorURL.Length &&
                        InnovatorURL.ToLower().Equals(ie.LocationURL.ToLower().Substring(0, InnovatorURL.Length)))
                    {
                        return(ie);
                    }
                }

                return(null);
            }
            else
            {
                return((InternetExplorer)(new InternetExplorerClass()));
            }
        }