建站学习网,专业提供各类建站教程,网页素材,SEO资讯等建站资源!
当前位置:建站学习网 > 网页设计 > 脚本HTML教程 >

如何改变CppWebBrowser的Html内容

整理编辑:建站学习网 更新时间:2017-04-13 阅读:0

 void __fastcall TForm1::SetHtml( TCppWebBrowser *WebBrowser,AnsiString 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;
}
 

转载请注明出处:https://www.dedexuexi.com/wysj/html/2878.html

关键词:HTML网页设计