Forum
Please
Log In
to post a new message or reply to an existing one. If you are not registered, please
register.
NOTE: Some forums may be read-only if you are not currently subscribed to
our technical support services.
Subject |
Author |
Date |
|
tera tera
|
Apr 20, 2009 - 1:25 AM
|
Hello. I want to display html information made in memory.
Is there a problem in the usage of the program? 
LPDISPATCH lpDocDisp = NULL;
HRESULT hr = m_HtmlCtrl.m_pBrowser->get_Document( &lpDocDisp );
if( FAILED(hr) || lpDocDisp == NULL ){
return ;
} IHTMLDocument2 * lpHtmlDoc2 = NULL;
hr = lpDocDisp->QueryInterface(
IID_IHTMLDocument2,
(void**)&lpHtmlDoc2
); SAFEARRAY *sfArray;
VARIANT *param; BSTR bstr = SysAllocString(OLESTR("<H1>TEST</H1>"));
sfArray = SafeArrayCreateVector(VT_VARIANT, 0, 1);
hr = SafeArrayAccessData(sfArray, (LPVOID*)¶m);
param->vt = VT_BSTR;
param->bstrVal = bstr;
hr = SafeArrayUnaccessData(sfArray);
hr = lpHtmlDoc2->write(sfArray);
lpHtmlDoc2->close(); SafeArrayDestroy(sfArray);
SysFreeString(bstr); lpDocDisp->Release();
lpHtmlDoc2->Release();
|
|
tera tera
|
Apr 20, 2009 - 6:59 PM
|
Hello. I want to display the html.
So I use WebBrowser2.
Thank you very much for your advice.
|
|
Technical Support
|
Apr 20, 2009 - 8:51 AM
|
Looks like correct. But some errors are present. Please invoke the SafeArrayDestroy(sfArray); last and not invoke the SysFreeString(bstr); because the string handle is destroyed by the SafeArrayDestroy(sfArray); code.
If you need a log view window with colorized text output, then you can get it from the MthOutput sample application.
|
|