Here's How To Save A Web Page As a Single File (MHT Format) Using Delphi Code:
Uses CDO_TLB, AdoDB_TLB;
...
Procedure WB_SAVEAS_MHT (WB: TWebBBBBBBBBROWSER; FileName: TFileName);
VAR
MSG: IMESSAGE;
Conf: iconfiguration;
Stream: _Stream;
URL: WideString;
Begin
IF not assigned (wb.document).
URL: = WB.LocationURL;
Msg: = casseage.create;
CONF: = Coconfiguration.create;
Try
Msg.Configuration: = Conf;
Msg.createmhtmlbody (URL, CDoSuppressall, '', ');
Stream: = msg.getStream;
Street.savetofile (FileName, AdsavecreateOverWrite);
Finally
Msg: = NIL;
CONF: = NIL;
Stream: = nil;
END;
END; (* wb_saveas_mht *)
Sample Usage:
// first navigate
Webbrowser1.naviGate ('http://delphi.about.com');
// Then Save
WB_SAVEAS_MHT (WebBrowser1, 'C: /WebBrowser1.mht');
Note 1: The _Stream class is defined in ADODB_TLB unit that you probably already have created The IMessage and IConfiguration interfaces code from cdosys.dll library CDO stands for Collaboration Data Objects - object libraries designed to enable SMTP Messaging The CDO_TLB is an auto... Generated unit by delphi. To create it, from the main menu Select "import type library", select "c: /windows/system32/cdosys.dll" The Click The "create unit" button.