Sample code for 30+ languages & platforms
DataFlex

Pack Local HTML File and Referenced Images as MHT Archive

See more MHT / HTML Email Examples

Demonstrates how to pack a local HTML file and referenced files (images, style sheets, etc.) into a .mht web archive.

Chilkat DataFlex Downloads

DataFlex
Use ChilkatAx-win32.pkg

Procedure Test
    Boolean iSuccess
    Handle hoMht
    String sTemp1

    Move False To iSuccess

    // This example assumes the Chilkat API to have been previously unlocked.
    // See Global Unlock Sample for sample code.

    Get Create (RefClass(cComChilkatMht)) To hoMht
    If (Not(IsComObjectCreated(hoMht))) Begin
        Send CreateComObject of hoMht
    End

    Get ComGetAndSaveMHT Of hoMht "C:/AAWorkarea/mht_unpack/test.html" "qa_output/test.mht" To iSuccess
    If (iSuccess = False) Begin
        Get ComLastErrorText Of hoMht To sTemp1
        Showln sTemp1
        Procedure_Return
    End
    Else Begin
        Showln "MHT Created!"
    End



End_Procedure