如何改变CppWebBrowser的Html内容
想要天天向上,就要懂得享受学习。图老师为大家推荐如何改变CppWebBrowser的Html内容,精彩的内容需要你们用心的阅读。还在等什么快点来看看吧!
{
IStream *Stream;
HGLOBAL hHTMLText;
IPersistStreamInit *psi;
if( WebBrowser-Document == NULL )
return;
hHTMLText = GlobalAlloc( GPTR, Html.Length() + 1 );
if( 0 == hHTMLText )
{
ShowMessage( "GlobalAlloc Error" );
return;
}
CopyMemory( hHTMLText, Html.c_str(), Html.Length() );
OleCheck( CreateStreamOnHGlobal( hHTMLText, true, &Stream ) );
try
{
OleCheck( WebBrowser-Document-QueryInterface( __uuidof(IPersistStreamInit), (void **)&psi ) );
try
{
OleCheck( psi-InitNew() );
OleCheck( psi-Load(Stream) );
}
catch( ... )
{
delete psi;
}
}
catch( ... )
{
delete Stream;
}
delete psi;
delete Stream;
}