procedure WB_SaveAs_MHT(WB: TWebBrowser; FileName: string);
var
Msg: IMessage;
Conf: IConfiguration;
Stream: _Stream;
URL: widestring;
{ _Stream定义在ADODB_TLB单元.IMessage和IConfiguration接口代码来自cdosys.dll.
CDO_TLB产生过程:选择菜单PROJECT中的"Import Type Library", 然后选择"C:\WINDOWS\system32\cdosys.dll"
文件,按下"Create unit"按钮.}
begin
if not Assigned(WB.Document) then Exit;
URL := WB.LocationURL;
Msg := CoMessage.Create;
Conf := CoConfiguration.Create;
try
Msg.Configuration := Conf;
Msg.CreateMHTMLBody(URL, cdoSuppressAll, '''', '''');
Stream := Msg.GetStream;
Stream.SaveToFile(FileName, adSaveCreateOverWrite);
finally
Msg := nil;
Conf := nil;
Stream := nil;
end;
end; (* WB_SaveAs_MHT *)