Ejemplo n.º 1
0
        private void AxWebBrowser_BeforeNavigate2(object sender, DWebBrowserEvents2_BeforeNavigate2Event e)
        {
            BrowserBeforeNavigate2EventArgs args = new BrowserBeforeNavigate2EventArgs(e);

            IntPtr thisPtr    = Marshal.GetIDispatchForObject(e.pDisp);
            IntPtr browserPtr = Marshal.GetIDispatchForObject(m_browser.GetOcx());
            bool   isDocument = (thisPtr == browserPtr);

            Marshal.Release(thisPtr);
            Marshal.Release(browserPtr);

            if (isDocument)
            {
                OnBeforeNavigate2Document(args);
            }
            else
            {
                OnBeforeNavigate2Frame(args);
            }

            args.PutBack(e);
        }
        private void AxWebBrowser_BeforeNavigate2(object sender, DWebBrowserEvents2_BeforeNavigate2Event e)
        {
            BrowserBeforeNavigate2EventArgs args = new BrowserBeforeNavigate2EventArgs(e);

            IntPtr thisPtr = Marshal.GetIDispatchForObject(e.pDisp);
            IntPtr browserPtr = Marshal.GetIDispatchForObject(m_browser.GetOcx());
            bool isDocument = (thisPtr == browserPtr);
            Marshal.Release(thisPtr);
            Marshal.Release(browserPtr);

            if (isDocument)
                OnBeforeNavigate2Document(args);
            else
                OnBeforeNavigate2Frame(args);

            args.PutBack(e);
        }