unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, OleCtrls, SHDocVw, StdCtrls,
ActiveX;
type
TForm1 =
class(TForm)
Memo1: TMemo;
WebBrowser1: TWebBrowser;
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private-Deklarationen }
public
{ Public-Deklarationen }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
function BBtoHTML(
html :
String):
STRING;
BEGIN
html:=StringReplace(
html,'
[','
<',[rfReplaceAll]);
html:=StringReplace(
html,'
]','
>',[rfReplaceAll]);
result := '
<html><head></head><body>'+
html+'
</body>';
END;
procedure TForm1.Button1Click(Sender: TObject);
var
memStream: TMemoryStream;
bbhtml :
STRING;
begin
bbhtml := BBtoHTML(memo1.Lines.Text);
webbrowser1.Navigate('
about:blank');
while webbrowser1.ReadyState <> READYSTATE_COMPLETE
do
begin
Sleep(5);
Application.ProcessMessages;
end;
memStream := TMemoryStream.Create;
memStream.
Write(Pointer(bbhtml)^,Length(bbhtml));
memStream.Seek(0,0);
(webbrowser1.Document
as IPersistStreamInit).Load(
TStreamAdapter.Create(memStream));
memStream.Free;
END;
end.