直接在WebBrowser中显示字符串

类别:Delphi 点击:0 评论:0 推荐:

//江雪 2001.06  http://asnowcn.at.china.com
//直接在WebBrowser中显示字符串
procedure ShowInWebBrowser(WebB:TWebBrowser;Str:String);
var
 v: Variant;
 HTMLDocument: IHTMLDocument2;
begin
 HTMLDocument := WebB.Document as IHTMLDocument2;
 if (assigned(HtmlDocument)) then  begin
   v := VarArrayCreate([0, 0], varVariant);
   v[0] := str; //that is to be shown
   HTMLDocument.Write(PSafeArray(TVarData(v).VArray));
   HTMLDocument.Close;
 end;
end;

本文地址:http://com.8s8s.com/it/it6095.htm