(* // Title: Save the web as a MHT file Description: Local page has not found how to pack pictures, know those who know the person, please send an email note: zwang support: wjhu111@21cn.com Date: 2004-01-05 / / *)
Uses comobj;
function MhtText (mURL: string): string; var vCDOMessage: OleVariant; begin vCDOMessage: = CreateOleObject ( 'CDO.Message'); vCDOMessage.Configuration: = CreateOleObject ( 'CDO.Configuration'); try vCDOMessage.CreateMHTMLBody (mURL); Result: = vcdomessage.getStream.ReadText; Except Raise; end; vcdomessage: = null; end; {mhttext}
function MhtFile (mURL: string; mFileName: string): Boolean; var vCDOMessage: OleVariant; begin vCDOMessage: = CreateOleObject ( 'CDO.Message'); vCDOMessage.Configuration: = CreateOleObject ( 'CDO.Configuration');
Result: = true; try vcdomessage.createmhtmlbody (murl); vcdomessage.getStream.savetofile (MfileName, $ 00000002); Except Result: = false; end; vcdomessage: = null; end; {mhtfile}
// ExampleProcedure TFORM1.BITBTN1CLICK (Sender: TOBJECT); Begin Mhtfile ('http://www.eping.net/fourm/index.asp', 'c: /temp/temp.mHt');