Beispiel #1
0
        public IntPtr GetBrowserForm()
        {
            IntPtr intptr = WinFormAPI.FindWindow(formName, null);

            if (intptr != (IntPtr)0)
            {
                return(intptr);
            }
            return((IntPtr)0);
        }
Beispiel #2
0
        public IntPtr GetBrowserUrlHandler(IntPtr phwnd)
        {
            IntPtr child = WinFormAPI.FindWindowEx(phwnd, 0, "WorkerW", null);

            child = WinFormAPI.FindWindowEx(child, 0, "ReBarWindow32", null);
            child = WinFormAPI.FindWindowEx(child, 0, "ComboBoxEx32", null);
            child = WinFormAPI.FindWindowEx(child, 0, "ComboBox", null);
            child = WinFormAPI.FindWindowEx(child, 0, "Edit", null);
            return(child);
        }
Beispiel #3
0
        public void RedirectUrl(WebBrowser webBrowser)
        {
            IntPtr        intptr    = webBrowser.GetBrowserUrlHandler(webBrowser.GetBrowserForm());
            StringBuilder strBuffer = new StringBuilder(1024);
            int           num       = WinFormAPI.SendMessage(intptr, WinFormAPI.WM_GETTEXT, 1024, strBuffer);
            string        strURL    = strBuffer.ToString().Trim('/').ToLower();

            if (strURL.IndexOf(orginUrl) != -1)
            {
                strBuffer.Remove(0, strBuffer.Length);
                strBuffer.Append(replaUrl);
                WinFormAPI.SendMessage(intptr, WinFormAPI.WM_SETTEXT, 1024, strBuffer);
                WinFormAPI.SendMessage(intptr, WinFormAPI.WM_KEYDOWN, WinFormAPI.VK_RETURN, 0);
            }
        }