Example #1
0
        /// <summary>
        /// 页面加载完成
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        void MyBrowser_DocumentCompleteEX(object sender, DocumentCompleteExEventArgs e)
        {
            if (!e.istoplevel)
            {
                return;
            }
            if (string.IsNullOrEmpty(LocationUrl) || LocationUrl == "about:blank")
            {
                return;
            }
            //if (IsMySite()) return;
            //浏览器的执行周期, uninitialized->loading->interactive->loaded->interactive->complete, 在包含frame的页面,
            //只有frame的ReadyState全部变成complete后, browser.ReadyState状态才会变成complete, 所以当browser.readyState=complete
            //的时候表示页面加载全部完成
            if (this.ReadyState == SHDocVw.tagREADYSTATE.READYSTATE_COMPLETE)
            {
                try
                {
                    FindForm().Text = DocumentTitle;
                }
                catch { }
                OnDocumentComplete(sender, e);
                if (DocumentFullComplete != null)
                {
                    DocumentFullComplete(this, EventArgs.Empty);
                }
            }

            //解决IE内存泄漏问题
            System.Diagnostics.Process loProcess = System.Diagnostics.Process.GetCurrentProcess();
            try
            {
                loProcess.MaxWorkingSet = (IntPtr)((int)loProcess.MaxWorkingSet - 1);
                loProcess.MinWorkingSet = (IntPtr)((int)loProcess.MinWorkingSet - 1);
            }
            catch (System.Exception)
            {
                loProcess.MaxWorkingSet = (IntPtr)((int)1413120);
                loProcess.MinWorkingSet = (IntPtr)((int)204800);
            }

            IntPtr pHandle = GetCurrentProcess();

            SetProcessWorkingSetSize(pHandle, -1, -1);
        }
Example #2
0
 protected virtual void OnDocumentComplete(object sender, DocumentCompleteExEventArgs e)
 {
 }