CComPtr<IPersistFile> pFile = NULL;
if(SUCCEEDED(pDoc2->QueryInterface(IID_IPersistFile,(void**) &pFile)))
{                  pFile->Save(filename.AllocSysString(),false);
}
向上面这样的编写的话,只能dump出网页的源代码,就类似在网页上用右键查看
源代码的结果一样。那么怎么能把Ajax动态插入的HTML源代码也写到文件中呢??
哪位大侠指教一下???谢谢

解决方案 »

  1.   

    虽然pFile->Save(filename.AllocSysString(),false);保存不了Ajax插入的HTML代码
    但是通过IHMTLDocument2是可以遍历到Ajax插入的HTML代码,好郁闷。不知道为什么
    能遍历到,却保持不了呢????
    救命啊 各位大侠
      

  2.   

    change the designMode property of the document to 'On' first
      

  3.   

    USES_CONVERSION;
       BSTR bstrMode;
       pDoc2->get_designMode(&bstrMode);
       char* cMode = OLE2A(bstrMode);
       if(strcmp(cMode,"On"))
       {
       pDoc2->put_designMode(OLESTR("On"));
       }
                          Thank you for your tips. however,it still can't work.
      

  4.   

    USES_CONVERSION;
    BSTR bstrMode;
    pDoc2->get_designMode(&bstrMode);
    char* cMode = OLE2A(bstrMode);
    if(strcmp(cMode,"On"))
    {
    pDoc2->put_designMode(OLESTR("On"));
    }CComPtr<IPersistFile> pFile = NULL;
    if(SUCCEEDED(pDoc2->QueryInterface(IID_IPersistFile,(void**) &pFile)))
    {       pFile->Save(filename.AllocSysString(),false);
    }
      

  5.   

    first find tag <HTML> in the HTMLDocument, then get the outerHTML
    and write to the destination file. This way makes it.
      

  6.   

    designMode 
    http://www.codeproject.com/editctrl/HtmlEdit.asp