Save the page for the MHT code

xiaoxiao2021-03-06  41

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. Excerpted from: http: // blog. 9cbs.net/technofantasy/archive/2005/01/21/262514.aspx

转载请注明原文地址:https://www.9cbs.com/read-65224.html

New Post(0)