(Delphi DLL) Pack Local HTML File and Referenced Images as MHT Archive
Demonstrates how to pack a local HTML file and referenced files (images, style sheets, etc.) into a .mht web archive.
uses
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls, Mht;
...
procedure TForm1.Button1Click(Sender: TObject);
var
mht: HCkMht;
success: Boolean;
begin
// This example assumes the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.
mht := CkMht_Create();
success := CkMht_GetAndSaveMHT(mht,'C:/AAWorkarea/mht_unpack/test.html','qa_output/test.mht');
if (success = False) then
begin
Memo1.Lines.Add(CkMht__lastErrorText(mht));
Exit;
end
else
begin
Memo1.Lines.Add('MHT Created!');
end;
CkMht_Dispose(mht);
end;
|