Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 509791
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T07:02:50+00:00 2026-05-13T07:02:50+00:00

After searching lot on the internet we have found following code to get only

  • 0

After searching lot on the internet we have found following code to get only body part of the web page loaded onto web browser control

IPIEHTMLDocument2 *pHTMLDocument;

IPIEHTMLElement* pBodyElement; 

CComPtr<IDispatch> spDispDoc;

HRESULT res = m_spWebBrowser2->get_Document(&spDispDoc);


if(SUCCEEDED(res))
{
    spDispDoc->QueryInterface( __uuidof(IPIEHTMLDocument2), (void**)&pHTMLDocument);

    WCHAR szText[256];
    DISPID id;
    OLECHAR FAR* szTemp;

    // store "body"
    szTemp = szText;
    StringCchPrintf(szText, 256, L"body", id);

    // get the body
    pHTMLDocument->GetIDsOfNames(IID_NULL, &szTemp, 1, LOCALE_USER_DEFAULT, &id);

    VARIANT varResult;
    varResult.vt = VT_DISPATCH;
    VARIANT FAR *pVarResult = &varResult;
    DISPPARAMS dispparamsNoArgs = {NULL, NULL, 0, 0};

    pHTMLDocument->Invoke(id, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_PROPERTYGET, &dispparamsNoArgs, pVarResult, NULL, NULL);

    BSTR bodyValue;

    if( NULL != pVarResult->pdispVal)
    {
        pVarResult->pdispVal->QueryInterface(IID_IPIEHTMLElement, (void**)&pBodyElement);

        pBodyElement->get_innerHTML(&bodyValue);
    }         
} 

But now how we get the remaining head and other tag document text from the loaded web page,
even we have tried passing “head” string to the GetIDsOfNames() method and it passes fail value, so we are struck.
Please provide us the method to access/ extract entire web page content in windows mobile 6.0

Thanks,
Ramanand Bhat.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T07:02:50+00:00Added an answer on May 13, 2026 at 7:02 am
    void  CBrowserWindow::ExtractWebPageDoc()
    
    {
    HRESULT                         hrResult           = E_FAIL;    
    IDispatch                      *pIDisp             = NULL;
    IPIEHTMLDocument3              *pIHTMLDocument     = NULL;
    IPIEHTMLElementCollection      *pHTMLElementcol    = NULL;
    IPIEHTMLImgElement             *pHTMLImgElement    = NULL; 
    
    
    hrResult = m_spIWebBrowser2->get_Document( &pIDisp);
    if (NULL != pIDisp)
    {
        hrResult = pIDisp->QueryInterface( __uuidof(IPIEHTMLDocument3), (void**)&pIHTMLDocument);
        if( NULL != pIHTMLDocument)
        {
            IPIEHTMLElement* pElement = NULL;
            CComBSTR pHTMLElement;
    
            hrResult = pIHTMLDocument->get_documentElement( &pElement);
            if (SUCCEEDED(hrResult)) 
            {                               
                pElement->get_innerHTML(&pHTMLElement.m_str);
                SaveToHTMLFile( pHTMLElement);
            }
    
            hrResult = pIHTMLDocument->get_images( &pHTMLElementcol);
            if (NULL != pHTMLElementcol)
            {
                CComBSTR  strImage;
                VARIANT vtBase, vtIndex;
                long pHTMLElementCollectionLength = 0;
    
                VariantInit( &vtBase);
                vtIndex.vt = VT_UINT;
    
                hrResult = pHTMLElementcol->get_length( &pHTMLElementCollectionLength);
                for (int ilen = 0; ilen < (int)pHTMLElementCollectionLength ; ilen++)
                {           
                    vtIndex.lVal = ilen;
    
                    pIDisp = NULL;
                    hrResult =  pHTMLElementcol->item( vtBase, vtIndex , &pIDisp);
                    if (NULL != pIDisp)
                    {
                        hrResult = pIDisp->QueryInterface( __uuidof(IPIEHTMLImgElement), (void**)&pHTMLImgElement);
    
                        if (NULL != pHTMLImgElement)
                        //CComQIPtr<IPIEHTMLImgElement> imgElement( pIDisp);
                        //imgElement->get_src( &strImage.m_str);    //I get it here :)
                        pHTMLImgElement->get_src( &strImage.m_str);
                    }
                }
            }
        }
    }
    

    }

    Above mentioned code gets the entire web page content in windows mobile devices.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

After a lot of searching, I have not found any solution for the following
After searching a lot, reading every tutorials I've found and asking some questions here,
After searching a lot i did not get any answers and finally i had
I want to write windows service in wcf After searching a lot I only
After searching on the web I didn't found a well-done article on the JCF
After searching the web for information, I have managed to create a service which,
I have never really thought about this until today, but after searching the web
After a lot of searching I found this regex that finds emails inside a
After searching online, the best solution I've found so far is to just make
What is the Java equivalent of PHP's $_POST ? After searching the web for

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.