if (FAILED(OleInitialize(NULL))) { return; } // Instantiate a browser if (FAILED(hr = CoCreateInstance(CLSID_InternetExplorer, NULL, CLSCTX_SERVER, IID_IWebBrowser2, (LPVOID*)&pWebBrowser))) { goto Error; } // Show the browser, and navigate to the special location // represented by the pidl hr = pWebBrowser->put_Visible(VARIANT_TRUE); IDispatch* pDocDisp = NULL; hr = pWebBrowser->get_Document(&pDocDisp);
另外,我刚接触session,想查些资料学习一下.
谢谢!
#define INITGUID
#include <initguid.h>
#include <exdisp.h>
#include <shlguid.h>
#include <memory.h>
#include <shlobj.h> HRESULT hr; IWebBrowser2* pWebBrowser = NULL;
if (FAILED(OleInitialize(NULL)))
{
return;
} // Instantiate a browser
if (FAILED(hr = CoCreateInstance(CLSID_InternetExplorer,
NULL, CLSCTX_SERVER, IID_IWebBrowser2,
(LPVOID*)&pWebBrowser)))
{
goto Error;
} // Show the browser, and navigate to the special location
// represented by the pidl
hr = pWebBrowser->put_Visible(VARIANT_TRUE); IDispatch* pDocDisp = NULL;
hr = pWebBrowser->get_Document(&pDocDisp);
if (pDocDisp)
{
IHTMLDocument2* pDoc = NULL;
hr = pDocDisp->QueryInterface(IID_IHTMLDocument2, reinterpret_cast<void **>(&pDoc)); IHTMLElement* pElement = NULL;
hr = pDoc->get_body(&pElement);
CString strHtmlText = lpData;//这里传入你读到的文本
BSTR bstrHTMLText = strHtmlText.AllocSysString();
hr = pElement ->put_outerHTML(&bstrHTMLText);
请问ShellExecute可以打开吗 ?
小弟菜点,能给个可以用的吗?看看,谢谢了!