interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, OleCtrls, SHDocVw, ActiveX;
type
TForm1 = class(TForm)
WebBrowser1: TWebBrowser;
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure WBLoadHTML(WebBrowser: TWebBrowser; HTMLCode: string) ;
var
sl: TStringList;
ms: TMemoryStream;
begin
WebBrowser.Navigate('about:blank') ;
while WebBrowser.ReadyState < READYSTATE_INTERACTIVE do
Application.ProcessMessages;
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.FormCreate(Sender: TObject) ;
var
sHTML : string;
begin
sHTML := '<a href="http://www.howto.pe.kr">GOTO</a>' +
'<b>howto.pe.kr</b>';
WBLoadHTML(WebBrowser1,sHTML) ;
end;
end.
'델파이' 카테고리의 다른 글
화면 캡쳐하기 (0) | 2019.09.23 |
---|---|
델파이 기초 - WebBrowser 기능 정리 (0) | 2011.09.22 |
Creating and Using DLLs from Delphi (0) | 2011.07.05 |
유니코드로 인코딩 된 텍스트 파일 읽기 (0) | 2011.07.05 |
ShellExecute(Ex) 사용법 예제 12가지 (0) | 2010.01.11 |