注册 登录
编程论坛 Delphi论坛

这段代码怎么在delphi(bho)中编译,有例程最好

y119977 发布于 2008-02-21 12:15, 1593 次点击
程序代码:
procedure WB_LoadHTML(webBrowser: TwebBrowser; HTMLCode: string);
var
   sl: TStringList;
   ms: TMemoryStream;
begin
   webBrowser.Navigate('about:blank');
   if Assigned(webBrowser.Document) then
   begin
      sl := TStringList.Create;
       try
          ms := TMemoryStream.Create;
          try
             sl.Text := HTMLCode;
             sl.SaveToStream(ms);  
              ms.Seek(0, 0);
              (webBrowser.Document as IPersistStreamInit).Load(TStreamAdapter.Create(ms));
          finally
             ms.Free;
          end;
      finally
        sl.Free;
     end;
    end;
end;

procedure TForm1.Button1Click(Sender: TObject);
begin
WB_LoadHTML(webBrowser1,'<html><body bgcolor="#0099FF">SwissdelphiCenter</html>');
end
1 回复
#2
思逸2008-03-05 17:16
好像不怎么明白你所要表达的问题~~
1