如何编程实现把WebBrowser存储为mht格式 如何编程实现把WebBrowser存储为*.mht格式(文件名自定义),且不弹出对话框,这个问题很象有点难,哪位高手,回答了,另开贴加分. 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 webbrowser1.ExecWB(OLECMDID_SAVEAS, OLECMDEXECOPT_DONTPROMPTUSER); //Delphi6+Windows2000调试通过~~(*//标题:将网页保存为mht文件说明:接口只定义需要使用的部分,如要研究请参考其他文档设计:Zswang支持:[email protected]日期:2004-01-05//*)///////Begin Sourceuses ComObj;///////Begin 接口定义// Constants for enum SaveOptionsEnumtype SaveOptionsEnum = TOleEnum;const adSaveCreateNotExist = $00000001; adSaveCreateOverWrite = $00000002;// Constants for enum CdoMHTMLFlagstype CdoMHTMLFlags = TOleEnum;const cdoSuppressNone = $00000000; cdoSuppressImages = $00000001; cdoSuppressBGSounds = $00000002; cdoSuppressFrames = $00000004; cdoSuppressObjects = $00000008; cdoSuppressStyleSheets = $00000010; cdoSuppressAll = $0000001F;// Constants for enum StreamTypeEnumtype StreamTypeEnum = TOleEnum;const adTypeBinary = $00000001; adTypeText = $00000002;// Constants for enum LineSeparatorEnumtype LineSeparatorEnum = TOleEnum;const adLF = $0000000A; adCR = $0000000D; adCRLF = $FFFFFFFF;// Constants for enum ObjectStateEnumtype ObjectStateEnum = TOleEnum;const adStateClosed = $00000000; adStateOpen = $00000001; adStateConnecting = $00000002; adStateExecuting = $00000004; adStateFetching = $00000008;// Constants for enum ConnectModeEnumtype ConnectModeEnum = TOleEnum;const adModeUnknown = $00000000; adModeRead = $00000001; adModeWrite = $00000002; adModeReadWrite = $00000003; adModeShareDenyRead = $00000004; adModeShareDenyWrite = $00000008; adModeShareExclusive = $0000000C; adModeShareDenyNone = $00000010; adModeRecursive = $00400000;// Constants for enum StreamOpenOptionsEnumtype StreamOpenOptionsEnum = TOleEnum;const adOpenStreamUnspecified = $FFFFFFFF; adOpenStreamAsync = $00000001; adOpenStreamFromRecord = $00000004;// Constants for enum StreamWriteEnumtype StreamWriteEnum = TOleEnum;const adWriteChar = $00000000; adWriteLine = $00000001; stWriteChar = $00000000; stWriteLine = $00000001;// Constants for enum CdoDSNOptionstype CdoDSNOptions = TOleEnum;const cdoDSNDefault = $00000000; cdoDSNNever = $00000001; cdoDSNFailure = $00000002; cdoDSNSuccess = $00000004; cdoDSNDelay = $00000008; cdoDSNSuccessFailOrDelay = $0000000E;// Constants for enum CdoReferenceTypetype CdoReferenceType = TOleEnum;const cdoRefTypeId = $00000000; cdoRefTypeLocation = $00000001;type IBodyPart = interface(IDispatch) ['{CD000021-8B95-11D1-82DB-00C04FB1625D}'] end; IBodyParts = interface(IDispatch) ['{CD000023-8B95-11D1-82DB-00C04FB1625D}'] end; _Collection = interface(IDispatch) ['{00000512-0000-0010-8000-00AA006D2EA4}'] end; Fields15 = interface(_Collection) ['{00000506-0000-0010-8000-00AA006D2EA4}'] end; Fields20 = interface(Fields15) ['{0000054D-0000-0010-8000-00AA006D2EA4}'] end; Fields = interface(Fields20) ['{00000564-0000-0010-8000-00AA006D2EA4}'] end; IDataSource = interface(IDispatch) ['{CD000029-8B95-11D1-82DB-00C04FB1625D}'] end;type _Stream = interface(IDispatch) ['{00000565-0000-0010-8000-00AA006D2EA4}'] function Get_Size: Integer; safecall; function Get_EOS: WordBool; safecall; function Get_Position: Integer; safecall; procedure Set_Position(pPos: Integer); safecall; function Get_Type_: StreamTypeEnum; safecall; procedure Set_Type_(ptype: StreamTypeEnum); safecall; function Get_LineSeparator: LineSeparatorEnum; safecall; procedure Set_LineSeparator(pLS: LineSeparatorEnum); safecall; function Get_State: ObjectStateEnum; safecall; function Get_Mode: ConnectModeEnum; safecall; procedure Set_Mode(pMode: ConnectModeEnum); safecall; function Get_Charset: WideString; safecall; procedure Set_Charset(const pbstrCharset: WideString); safecall; function Read(NumBytes: Integer): OleVariant; safecall; procedure Open(Source: OleVariant; Mode: ConnectModeEnum; Options: StreamOpenOptionsEnum; const UserName: WideString; const Password: WideString); safecall; procedure Close; safecall; procedure SkipLine; safecall; procedure Write(Buffer: OleVariant); safecall; procedure SetEOS; safecall; procedure CopyTo(const DestStream: _Stream; CharNumber: Integer); safecall; procedure Flush; safecall; procedure SaveToFile(const FileName: WideString; Options: SaveOptionsEnum); safecall; procedure LoadFromFile(const FileName: WideString); safecall; function ReadText(NumChars: Integer): WideString; safecall; procedure WriteText(const Data: WideString; Options: StreamWriteEnum); safecall; procedure Cancel; safecall; property Size: Integer read Get_Size; property EOS: WordBool read Get_EOS; property Position: Integer read Get_Position write Set_Position; property Type_: StreamTypeEnum read Get_Type_ write Set_Type_; property LineSeparator: LineSeparatorEnum read Get_LineSeparator write Set_LineSeparator; property State: ObjectStateEnum read Get_State; property Mode: ConnectModeEnum read Get_Mode write Set_Mode; property Charset: WideString read Get_Charset write Set_Charset; end; IConfiguration = interface(IDispatch) ['{CD000022-8B95-11D1-82DB-00C04FB1625D}'] end; IMessage = interface(IDispatch) ['{CD000020-8B95-11D1-82DB-00C04FB1625D}'] function Get_BCC: WideString; safecall; procedure Set_BCC(const pBCC: WideString); safecall; function Get_CC: WideString; safecall; procedure Set_CC(const pCC: WideString); safecall; function Get_FollowUpTo: WideString; safecall; procedure Set_FollowUpTo(const pFollowUpTo: WideString); safecall; function Get_From: WideString; safecall; procedure Set_From(const pFrom: WideString); safecall; function Get_Keywords: WideString; safecall; procedure Set_Keywords(const pKeywords: WideString); safecall; function Get_MimeFormatted: WordBool; safecall; procedure Set_MimeFormatted(pMimeFormatted: WordBool); safecall; function Get_Newsgroups: WideString; safecall; procedure Set_Newsgroups(const pNewsgroups: WideString); safecall; function Get_Organization: WideString; safecall; procedure Set_Organization(const pOrganization: WideString); safecall; function Get_ReceivedTime: TDateTime; safecall; function Get_ReplyTo: WideString; safecall; procedure Set_ReplyTo(const pReplyTo: WideString); safecall; function Get_DSNOptions: CdoDSNOptions; safecall; procedure Set_DSNOptions(pDSNOptions: CdoDSNOptions); safecall; function Get_SentOn: TDateTime; safecall; function Get_Subject: WideString; safecall; procedure Set_Subject(const pSubject: WideString); safecall; function Get_To_: WideString; safecall; procedure Set_To_(const pTo: WideString); safecall; function Get_TextBody: WideString; safecall; procedure Set_TextBody(const pTextBody: WideString); safecall; function Get_HTMLBody: WideString; safecall; procedure Set_HTMLBody(const pHTMLBody: WideString); safecall; function Get_Attachments: IBodyParts; safecall; function Get_Sender: WideString; safecall; procedure Set_Sender(const pSender: WideString); safecall; function Get_Configuration: IConfiguration; safecall; procedure _Set_Configuration(const pConfiguration: IConfiguration); safecall; procedure Set_Configuration(const pConfiguration: IConfiguration); safecall; function Get_AutoGenerateTextBody: WordBool; safecall; procedure Set_AutoGenerateTextBody(pAutoGenerateTextBody: WordBool); safecall; function Get_EnvelopeFields: Fields; safecall; function Get_TextBodyPart: IBodyPart; safecall; function Get_HTMLBodyPart: IBodyPart; safecall; function Get_BodyPart: IBodyPart; safecall; function Get_DataSource: IDataSource; safecall; function Get_Fields: Fields; safecall; function Get_MDNRequested: WordBool; safecall; procedure Set_MDNRequested(pMDNRequested: WordBool); safecall; function AddRelatedBodyPart(const URL: WideString; const Reference: WideString; ReferenceType: CdoReferenceType; const UserName: WideString; const Password: WideString): IBodyPart; safecall; function AddAttachment(const URL: WideString; const UserName: WideString; const Password: WideString): IBodyPart; safecall; procedure CreateMHTMLBody(const URL: WideString; Flags: CdoMHTMLFlags; const UserName: WideString; const Password: WideString); safecall; function Forward: IMessage; safecall; procedure Post; safecall; function PostReply: IMessage; safecall; function Reply: IMessage; safecall; function ReplyAll: IMessage; safecall; procedure Send; safecall; function GetStream: _Stream; safecall; function GetInterface(const Interface_: WideString): IDispatch; safecall; property BCC: WideString read Get_BCC write Set_BCC; property CC: WideString read Get_CC write Set_CC; property FollowUpTo: WideString read Get_FollowUpTo write Set_FollowUpTo; property From: WideString read Get_From write Set_From; property Keywords: WideString read Get_Keywords write Set_Keywords; property MimeFormatted: WordBool read Get_MimeFormatted write Set_MimeFormatted; property Newsgroups: WideString read Get_Newsgroups write Set_Newsgroups; property Organization: WideString read Get_Organization write Set_Organization; property ReceivedTime: TDateTime read Get_ReceivedTime; property ReplyTo: WideString read Get_ReplyTo write Set_ReplyTo; property DSNOptions: CdoDSNOptions read Get_DSNOptions write Set_DSNOptions; property SentOn: TDateTime read Get_SentOn; property Subject: WideString read Get_Subject write Set_Subject; property To_: WideString read Get_To_ write Set_To_; property TextBody: WideString read Get_TextBody write Set_TextBody; property HTMLBody: WideString read Get_HTMLBody write Set_HTMLBody; property Attachments: IBodyParts read Get_Attachments; property Sender: WideString read Get_Sender write Set_Sender; property Configuration: IConfiguration read Get_Configuration write _Set_Configuration; property AutoGenerateTextBody: WordBool read Get_AutoGenerateTextBody write Set_AutoGenerateTextBody; property EnvelopeFields: Fields read Get_EnvelopeFields; property TextBodyPart: IBodyPart read Get_TextBodyPart; property HTMLBodyPart: IBodyPart read Get_HTMLBodyPart; property BodyPart: IBodyPart read Get_BodyPart; property DataSource: IDataSource read Get_DataSource; property Fields: Fields read Get_Fields; property MDNRequested: WordBool read Get_MDNRequested write Set_MDNRequested; end;const CLASS_Message: TGUID = '{CD000001-8B95-11D1-82DB-00C04FB1625D}'; CLASS_Configuration: TGUID = '{CD000002-8B95-11D1-82DB-00C04FB1625D}';///////End 接口定义procedure SaveWholePage(mURL: string; mFileName: TFileName);var vMessage: IMessage; vConfiguration: IConfiguration; vStream: _Stream;begin vMessage := CreateComObject(CLASS_Message) as IMessage; vConfiguration := CreateComObject(CLASS_Configuration) as IConfiguration; try vMessage.Configuration := vConfiguration; vMessage.CreateMHTMLBody(mURL, cdoSuppressAll, '', ''); vStream := vMessage.GetStream; vStream.SaveToFile(mFileName, adSaveCreateOverWrite); finally vMessage := nil; vConfiguration := nil; vStream := nil; end;end;///////End Source//Exampleprocedure TForm1.Button1Click(Sender: TObject);begin SaveWholePage('http://www.eping.net/fourm/', 'c:\temp\temp.mht');end; 我下载了一个控件可以从国外下载,可以保存为eml,zip,mht灯各种格式,但是对于xml的好像就不行了,需要么 在应用时这句出了问题,提示为‘无效的语法’vMessage.CreateMHTMLBody(mURL, cdoSuppressAll, '', ''); 只要你做了,就有分了,谢谢大家帮忙了 请高手帮忙:如何快速将老应用转换为服务器-客户端架构 用dataset提交数据没有成功! 刚发现中山大学DELPHI的视频教程!经典中的经典啊! 请问这是怎么回事?EStringListError ,List index out of bounds(-2); 专科生不能做程序员? 利用ClientDataSet一次操作多条不连续记录 困惑! 各位仁兄,请看一下我的程序出错在哪里,这个窗口应该如何建立,不胜感激! 求教!如何实现用户自定义卡片(复杂报表)? 登陆出现的问题,求助! 紧急求助:strtodate转换后的格式以及日期之间的运算问题。
webbrowser1.ExecWB(OLECMDID_SAVEAS, OLECMDEXECOPT_DONTPROMPTUSER);
标题:将网页保存为mht文件
说明:接口只定义需要使用的部分,如要研究请参考其他文档
设计:Zswang
支持:[email protected]
日期:2004-01-05
//*)///////Begin Source
uses ComObj;///////Begin 接口定义
// Constants for enum SaveOptionsEnum
type
SaveOptionsEnum = TOleEnum;
const
adSaveCreateNotExist = $00000001;
adSaveCreateOverWrite = $00000002;// Constants for enum CdoMHTMLFlags
type
CdoMHTMLFlags = TOleEnum;
const
cdoSuppressNone = $00000000;
cdoSuppressImages = $00000001;
cdoSuppressBGSounds = $00000002;
cdoSuppressFrames = $00000004;
cdoSuppressObjects = $00000008;
cdoSuppressStyleSheets = $00000010;
cdoSuppressAll = $0000001F;// Constants for enum StreamTypeEnum
type
StreamTypeEnum = TOleEnum;
const
adTypeBinary = $00000001;
adTypeText = $00000002;// Constants for enum LineSeparatorEnum
type
LineSeparatorEnum = TOleEnum;
const
adLF = $0000000A;
adCR = $0000000D;
adCRLF = $FFFFFFFF;// Constants for enum ObjectStateEnum
type
ObjectStateEnum = TOleEnum;
const
adStateClosed = $00000000;
adStateOpen = $00000001;
adStateConnecting = $00000002;
adStateExecuting = $00000004;
adStateFetching = $00000008;// Constants for enum ConnectModeEnum
type
ConnectModeEnum = TOleEnum;
const
adModeUnknown = $00000000;
adModeRead = $00000001;
adModeWrite = $00000002;
adModeReadWrite = $00000003;
adModeShareDenyRead = $00000004;
adModeShareDenyWrite = $00000008;
adModeShareExclusive = $0000000C;
adModeShareDenyNone = $00000010;
adModeRecursive = $00400000;// Constants for enum StreamOpenOptionsEnum
type
StreamOpenOptionsEnum = TOleEnum;
const
adOpenStreamUnspecified = $FFFFFFFF;
adOpenStreamAsync = $00000001;
adOpenStreamFromRecord = $00000004;// Constants for enum StreamWriteEnum
type
StreamWriteEnum = TOleEnum;
const
adWriteChar = $00000000;
adWriteLine = $00000001;
stWriteChar = $00000000;
stWriteLine = $00000001;// Constants for enum CdoDSNOptions
type
CdoDSNOptions = TOleEnum;
const
cdoDSNDefault = $00000000;
cdoDSNNever = $00000001;
cdoDSNFailure = $00000002;
cdoDSNSuccess = $00000004;
cdoDSNDelay = $00000008;
cdoDSNSuccessFailOrDelay = $0000000E;// Constants for enum CdoReferenceType
type
CdoReferenceType = TOleEnum;
const
cdoRefTypeId = $00000000;
cdoRefTypeLocation = $00000001;type
IBodyPart = interface(IDispatch)
['{CD000021-8B95-11D1-82DB-00C04FB1625D}']
end;
IBodyParts = interface(IDispatch)
['{CD000023-8B95-11D1-82DB-00C04FB1625D}']
end;
_Collection = interface(IDispatch)
['{00000512-0000-0010-8000-00AA006D2EA4}']
end;
Fields15 = interface(_Collection)
['{00000506-0000-0010-8000-00AA006D2EA4}']
end;
Fields20 = interface(Fields15)
['{0000054D-0000-0010-8000-00AA006D2EA4}']
end;
Fields = interface(Fields20)
['{00000564-0000-0010-8000-00AA006D2EA4}']
end;
IDataSource = interface(IDispatch)
['{CD000029-8B95-11D1-82DB-00C04FB1625D}']
end;type
_Stream = interface(IDispatch)
['{00000565-0000-0010-8000-00AA006D2EA4}']
function Get_Size: Integer; safecall;
function Get_EOS: WordBool; safecall;
function Get_Position: Integer; safecall;
procedure Set_Position(pPos: Integer); safecall;
function Get_Type_: StreamTypeEnum; safecall;
procedure Set_Type_(ptype: StreamTypeEnum); safecall;
function Get_LineSeparator: LineSeparatorEnum; safecall;
procedure Set_LineSeparator(pLS: LineSeparatorEnum); safecall;
function Get_State: ObjectStateEnum; safecall;
function Get_Mode: ConnectModeEnum; safecall;
procedure Set_Mode(pMode: ConnectModeEnum); safecall;
function Get_Charset: WideString; safecall;
procedure Set_Charset(const pbstrCharset: WideString); safecall;
function Read(NumBytes: Integer): OleVariant; safecall;
procedure Open(Source: OleVariant; Mode: ConnectModeEnum; Options: StreamOpenOptionsEnum;
const UserName: WideString; const Password: WideString); safecall;
procedure Close; safecall;
procedure SkipLine; safecall;
procedure Write(Buffer: OleVariant); safecall;
procedure SetEOS; safecall;
procedure CopyTo(const DestStream: _Stream; CharNumber: Integer); safecall;
procedure Flush; safecall;
procedure SaveToFile(const FileName: WideString; Options: SaveOptionsEnum); safecall;
procedure LoadFromFile(const FileName: WideString); safecall;
function ReadText(NumChars: Integer): WideString; safecall;
procedure WriteText(const Data: WideString; Options: StreamWriteEnum); safecall;
procedure Cancel; safecall;
property Size: Integer read Get_Size;
property EOS: WordBool read Get_EOS;
property Position: Integer read Get_Position write Set_Position;
property Type_: StreamTypeEnum read Get_Type_ write Set_Type_;
property LineSeparator: LineSeparatorEnum read Get_LineSeparator write Set_LineSeparator;
property State: ObjectStateEnum read Get_State;
property Mode: ConnectModeEnum read Get_Mode write Set_Mode;
property Charset: WideString read Get_Charset write Set_Charset;
end; IConfiguration = interface(IDispatch)
['{CD000022-8B95-11D1-82DB-00C04FB1625D}']
end;
['{CD000020-8B95-11D1-82DB-00C04FB1625D}']
function Get_BCC: WideString; safecall;
procedure Set_BCC(const pBCC: WideString); safecall;
function Get_CC: WideString; safecall;
procedure Set_CC(const pCC: WideString); safecall;
function Get_FollowUpTo: WideString; safecall;
procedure Set_FollowUpTo(const pFollowUpTo: WideString); safecall;
function Get_From: WideString; safecall;
procedure Set_From(const pFrom: WideString); safecall;
function Get_Keywords: WideString; safecall;
procedure Set_Keywords(const pKeywords: WideString); safecall;
function Get_MimeFormatted: WordBool; safecall;
procedure Set_MimeFormatted(pMimeFormatted: WordBool); safecall;
function Get_Newsgroups: WideString; safecall;
procedure Set_Newsgroups(const pNewsgroups: WideString); safecall;
function Get_Organization: WideString; safecall;
procedure Set_Organization(const pOrganization: WideString); safecall;
function Get_ReceivedTime: TDateTime; safecall;
function Get_ReplyTo: WideString; safecall;
procedure Set_ReplyTo(const pReplyTo: WideString); safecall;
function Get_DSNOptions: CdoDSNOptions; safecall;
procedure Set_DSNOptions(pDSNOptions: CdoDSNOptions); safecall;
function Get_SentOn: TDateTime; safecall;
function Get_Subject: WideString; safecall;
procedure Set_Subject(const pSubject: WideString); safecall;
function Get_To_: WideString; safecall;
procedure Set_To_(const pTo: WideString); safecall;
function Get_TextBody: WideString; safecall;
procedure Set_TextBody(const pTextBody: WideString); safecall;
function Get_HTMLBody: WideString; safecall;
procedure Set_HTMLBody(const pHTMLBody: WideString); safecall;
function Get_Attachments: IBodyParts; safecall;
function Get_Sender: WideString; safecall;
procedure Set_Sender(const pSender: WideString); safecall;
function Get_Configuration: IConfiguration; safecall;
procedure _Set_Configuration(const pConfiguration: IConfiguration); safecall;
procedure Set_Configuration(const pConfiguration: IConfiguration); safecall;
function Get_AutoGenerateTextBody: WordBool; safecall;
procedure Set_AutoGenerateTextBody(pAutoGenerateTextBody: WordBool); safecall;
function Get_EnvelopeFields: Fields; safecall;
function Get_TextBodyPart: IBodyPart; safecall;
function Get_HTMLBodyPart: IBodyPart; safecall;
function Get_BodyPart: IBodyPart; safecall;
function Get_DataSource: IDataSource; safecall;
function Get_Fields: Fields; safecall;
function Get_MDNRequested: WordBool; safecall;
procedure Set_MDNRequested(pMDNRequested: WordBool); safecall;
function AddRelatedBodyPart(const URL: WideString; const Reference: WideString;
ReferenceType: CdoReferenceType; const UserName: WideString;
const Password: WideString): IBodyPart; safecall;
function AddAttachment(const URL: WideString; const UserName: WideString;
const Password: WideString): IBodyPart; safecall;
procedure CreateMHTMLBody(const URL: WideString; Flags: CdoMHTMLFlags;
const UserName: WideString; const Password: WideString); safecall;
function Forward: IMessage; safecall;
procedure Post; safecall;
function PostReply: IMessage; safecall;
function Reply: IMessage; safecall;
function ReplyAll: IMessage; safecall;
procedure Send; safecall;
function GetStream: _Stream; safecall;
function GetInterface(const Interface_: WideString): IDispatch; safecall;
property BCC: WideString read Get_BCC write Set_BCC;
property CC: WideString read Get_CC write Set_CC;
property FollowUpTo: WideString read Get_FollowUpTo write Set_FollowUpTo;
property From: WideString read Get_From write Set_From;
property Keywords: WideString read Get_Keywords write Set_Keywords;
property MimeFormatted: WordBool read Get_MimeFormatted write Set_MimeFormatted;
property Newsgroups: WideString read Get_Newsgroups write Set_Newsgroups;
property Organization: WideString read Get_Organization write Set_Organization;
property ReceivedTime: TDateTime read Get_ReceivedTime;
property ReplyTo: WideString read Get_ReplyTo write Set_ReplyTo;
property DSNOptions: CdoDSNOptions read Get_DSNOptions write Set_DSNOptions;
property SentOn: TDateTime read Get_SentOn;
property Subject: WideString read Get_Subject write Set_Subject;
property To_: WideString read Get_To_ write Set_To_;
property TextBody: WideString read Get_TextBody write Set_TextBody;
property HTMLBody: WideString read Get_HTMLBody write Set_HTMLBody;
property Attachments: IBodyParts read Get_Attachments;
property Sender: WideString read Get_Sender write Set_Sender;
property Configuration: IConfiguration read Get_Configuration write _Set_Configuration;
property AutoGenerateTextBody: WordBool read Get_AutoGenerateTextBody write Set_AutoGenerateTextBody;
property EnvelopeFields: Fields read Get_EnvelopeFields;
property TextBodyPart: IBodyPart read Get_TextBodyPart;
property HTMLBodyPart: IBodyPart read Get_HTMLBodyPart;
property BodyPart: IBodyPart read Get_BodyPart;
property DataSource: IDataSource read Get_DataSource;
property Fields: Fields read Get_Fields;
property MDNRequested: WordBool read Get_MDNRequested write Set_MDNRequested;
end;const
CLASS_Message: TGUID = '{CD000001-8B95-11D1-82DB-00C04FB1625D}';
CLASS_Configuration: TGUID = '{CD000002-8B95-11D1-82DB-00C04FB1625D}';
///////End 接口定义procedure SaveWholePage(mURL: string; mFileName: TFileName);
var
vMessage: IMessage;
vConfiguration: IConfiguration;
vStream: _Stream;
begin
vMessage := CreateComObject(CLASS_Message) as IMessage;
vConfiguration := CreateComObject(CLASS_Configuration) as IConfiguration;
try
vMessage.Configuration := vConfiguration;
vMessage.CreateMHTMLBody(mURL, cdoSuppressAll, '', '');
vStream := vMessage.GetStream;
vStream.SaveToFile(mFileName, adSaveCreateOverWrite);
finally
vMessage := nil;
vConfiguration := nil;
vStream := nil;
end;
end;
///////End Source//Example
procedure TForm1.Button1Click(Sender: TObject);
begin
SaveWholePage('http://www.eping.net/fourm/', 'c:\temp\temp.mht');
end;
vMessage.CreateMHTMLBody(mURL, cdoSuppressAll, '', '');