...HTML Seiten als MHTML-Datei (HTML Archiv Format) speichern?
Autor: shadows
function SaveToMHT(const AUrl, AFileName: string;
AShowErrorMessage: Boolean = False): Boolean;
var
oMSG, oConfig: OleVariant;
sFileName: string;
Retvar: Boolean;
begin
sFileName := ChangeFileExt(AFileName, '.mht');
DeleteFile(PAnsiChar(sFileName));
try
oConfig := CreateOleObject('CDO.Configuration');
oMSG := CreateOleObject('CDO.Message');
oMSG.Configuration := oConfig;
oMSG.CreateMHTMLBody(AUrl);
oMSG.GetStream.SaveToFile(sFileName);
Retvar := True;
except
on E: Exception do
begin
if AShowErrorMessage then MessageDlg(E.Message, mtError, [mbOK], 0);
Retvar := False;
end;
end;
oMSG := VarNull;
oConfig := VarNull;
Result := Retvar;
end;
printed from
www.swissdelphicenter.ch
developers knowledge base