Meta-analysis of MFC WebBrowser reading documents

Source: Internet
Author: User

idispatch* pdisp =Null;idispatch* PDISP2 =Null;ihtmldocument2*PHTMLDOC2 =null;ihtmlelementcollection*pcol;ihtmlmetaelement*pmeta =NULL; BSTR BURL=NULL; BSTR BSTR=NULL;Try {    if((pdisp = M_webbrowser.get_document ()) &&SUCCEEDED (Pdisp->queryinterface (Iid_ihtmldocument2, (pvoid*) &pHtmlDoc2)) && succeeded (Phtmldoc2->get_all (&pcol)) &&pcol) {        //Check if the domain name is www.test.com or www.test2.com, if the META tag has a myflag tag, if there is a page that is considered correct bisgoodwebpage is truePhtmldoc2->get_url (&BURL); if(Wcsstr (Constwchar_t*) BUrl, L"www.test.com") ==NULL&& Wcsstr ((Constwchar_t*) BUrl, L"www.test2.com") ==NULL) {Bisgoodwebpage=TRUE; }        Else        {            LongElelen =0; Pcol->get_length (&Elelen); IHTMLMetaElement* Pmetaelement =NULL;            VARIANT VarIndex;            HRESULT hr;  for(intI=0; i< Elelen; i++) {VARIANT var2; VARINDEX.VT=Vt_uint; Varindex.lval=i; VariantInit (&var2); HR= Pcol->item (VarIndex, VAR2, &pDisp2); HR= Pdisp2->queryinterface (Iid_ihtmlmetaelement, (void* *) &Pmeta); if(hr = =S_OK) {                    if(SUCCEEDED (Pmeta->get_httpequiv (&BSTR)) )                    {                        if(!WCSCMP (Constwchar_t*) bstr,l"keywords") ) {BSTR=NULL; if(SUCCEEDED (Pmeta->get_content (&BSTR))) {                                if(!WCSCMP (Constwchar_t*) BSTR, L"Myflag") ) {Bisgoodwebpage=TRUE;  Break;    }                            }                        }                        }                }            }        } }}Catch (...) {Wbtrace ("error\r\n");} Safe_release (Pmeta); Safe_release (PDISP2); Safe_release (PHTMLDOC2); Safe_release (pdisp);

Meta-analysis of MFC WebBrowser reading documents

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.