IPersistStreamInit :: Save()在IE9中不起作用?

时间:2011-09-09 10:56:29

标签: save iwebbrowser2 ihtmldocument2

此代码适用于IE8及更早版本。对于IE9,似乎IPersistStreamInit :: Save()返回E_NOTIMPL。非常感谢任何帮助!

HRESULT CHtmlCtrl::GetDocumentHTML(CString& strHTML) const
{
    HRESULT hr = E_NOINTERFACE;

    CComPtr<IHTMLDocument2> spHTMLDocument;
    GetHtmlDocument()->QueryInterface(IID_IHTMLDocument2, (LPVOID*)&spHTMLDocument);
    if (spHTMLDocument)
    {
        CComQIPtr<IPersistStreamInit> spPSI;
        spPSI = spHTMLDocument;
        if (spPSI)
        {
            CStreamOnCString stream;
            hr = spPSI->Save(static_cast<IStream*>(&stream), FALSE);
            if (hr == S_OK)
            {
                if (!stream.CopyData(strHTML))
                    hr = E_OUTOFMEMORY;
            }
        }
    }

    return hr;
}

1 个答案:

答案 0 :(得分:1)

似乎是所描述和确认的MFC中的错误here。 Visual Studio 2012 RTM中的Fixed