Screen WebBrowser Open the popup window of the webpage

Source: Internet
Author: User

<strong>1.   Block "JS error" pop-up window when opening a webpage </strong> method I:   set WebBrowser's "Silent" property to "True" Method II: Code implementation m_web.put_silent (TRUE);    //m_web is a Web control variable <strong>2.   Masking other pop-up windows when opening a webpage </strong> method I: The method "Onambientproperty" associated with overloading the Web control's window is as follows://[description] This function is the main window method overload, You can block all scripts that open Web pages from running and pop-up windows, so use caution. #include "mshtmdid.h" BOOL cansdlg::onambientproperty (colecontrolsite* psite, DispID DispID, variant* pvar) {//TODO:   Here Add private code and/or Call base class if (DispID = = Dispid_ambient_dlcontrol) {PVAR-&GT;VT = Vt_i4;pvar->lval = Dlctl_no_runactivexctls | dlctl_no_scripts | Dlctl_no_java | Dlctl_no_dlactivexctls           | Dlctl_no_framedownload | dlctl_no_behaviors | Dlctl_no_framedownload | Dlctl_silent;return TRUE;} Return Cdialogex::onambientproperty (Psite, DispID, Pvar);} Method II: The "NEWWINDOW3" event related code for the overloaded Web control is as follows://This method prevents opening a Web page by blocking opening a new window to the popup void Cansdlg::newwindow3explorer1 (lpdispatch* ppdisp, bool* Cancel, unsigned long dwFlags, LPCTSTR Bstrurlcontext, LPCTSTR bstrurl) {//TODO:   Add message processing hereOrder code//Do not open new window *cancel = TRUE;} 

Screen WebBrowser Open the popup window of the webpage

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.