개념 : TWebBrowser에서 Document 인터페이스를 얻어서 body 부분에 문자를 추가할 수 있다.
var
HTMLDocument : IHTMLDocument2;
WebBrowser1 : TWebBrowser
HTMLDocument := WebBrowser1.Document as IHTMLDocument2;
HTMLDocument.body.insertAdjacentHTML('BeforeEnd','안녕하세요...<br>');
//참고 게시물
http://www.delmadang.com/cwb-bin/CrazyWWWBoard.exe?db=dmdlec&mode=read&num=1471&page=1&backdepth=1/////////////////////////////////////////
//델마당 강좌 4000king님 작성 소스
procedure TFormMain.AddChatText(iRoomType:integer;sColor,sChatText:string);
var
sWhere:Olevariant;
sAddText:Olevariant;
begin
sWhere:='beforeEnd';
sAddText:='<font size=2 color='+'#'+sColor+'>'+sChatText+'</font><br>';
if iRoomType=rtChatRoom then begin
WebBrowserChat.OleObject.Document.Body.InsertAdjacentHTML(sWhere, sAddText);
WebBrowserChat.OleObject.Document.Body.scrollTop:=20000; // pixel
inc(ChatTextLineCount);
end else if iRoomType=rtDateRoom then begin
WebBrowserChatDate.OleObject.Document.Body.InsertAdjacentHTML(sWhere, sAddText);
WebBrowserChatDate.OleObject.Document.Body.scrollTop:=20000;
inc(ChatTextLineCount);
end;
if ChatTextLineCount >=1000 then begin
ClearWebbrowserChat(iRoomType);
ChatTextLineCount:=0;
end;
end;