【问题标题】:IPersistStreamInit::Save() not working in IE9?IPersistStreamInit::Save() 在 IE9 中不起作用?
【发布时间】:2011-09-09 10:56:28
【问题描述】:

此代码适用于 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;
}

【问题讨论】:

    标签: save iwebbrowser2 ihtmldocument2


    【解决方案1】:

    正如here 所描述和确认的那样,这似乎是 MFC 中的一个错误。 Fixed 在 Visual Studio 2012 RTM 中。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2012-03-05
      • 2018-04-29
      • 2012-02-09
      • 2012-08-02
      • 2014-05-04
      • 2011-07-29
      • 2015-10-08
      • 2013-10-29
      相关资源
      最近更新 更多