procedure THandShake.CreateHTML();
var
HTML:String;
begin
HTML:='<table width="100%" style="font-size:9pt;border:1px solid #808080;background-color:#FFFFCE;padding:2px;Scolor:'+SysTextColor+';margin-top:2px;margin-bottom:5px;filter: alpha(opacity=80);"><tr><td>';
ImageID:='Image_'+BaseID;
HTML:=HTML+'<img id="'+ImageID+'" src="'+ResPath+'/Images/Video.gif'+'" align="texttop"> ';
.....
InsertHTML(ChatingForm,ChatingForm.MsgContent,HTML);
end;
//----------------------{插入HTML代码至WebBrowser中}-----------
procedure InsertHTML(ChatingForm:TForm;IE:TWebbrowser;HTML:String);
var
DoC: IHTMLDocument2;
begin
Doc := IE.Document as IHTMLDocument2;
Doc.body.innerHTML:=Doc.body.innerHTML+HTML;
sendMessage(GetWindow(GetWindow(IE.Handle,GW_CHILD),GW_CHILD), WM_VSCROLL, SB_BOTTOM, 0); //发送到底消息
sendMessage(GetWindow(GetWindow(IE.Handle,GW_CHILD),GW_CHILD), WM_VSCROLL, SB_BOTTOM, 0); //发送到底消息
sendMessage(GetWindow(GetWindow(IE.Handle,GW_CHILD),GW_CHILD), WM_VSCROLL, SB_BOTTOM, 0); //发送到底消息
if ChatingForm<>nil then
begin
with ChatingForm do
begin
if (not Focused) and (GetForegroundWindow<>Handle) and ((not Pushed and not Visible) or (Pushed and Visible)) and (not DontPlaySound) then
begin
PlayEventSound(MsgSound);
FocusForm(ChatingForm);
end;
end
end;
end;
大概就这个意思。图片也一样可以这样插进去