Sample code for 30+ languages & platforms
DataFlex

Save Web Page to MHT String

See more MHT / HTML Email Examples

Downloads a web page into a string variable containing MHT. MHT is a web archive with all images and style sheets embedded. It's a MIME-formatted text document. When saved with the .mht extension, Internet Explorer can open and display the page.

Chilkat DataFlex Downloads

DataFlex
Use ChilkatAx-win32.pkg

Procedure Test
    Handle hoMht
    String sMhtStr
    String sTemp1
    Boolean bTemp1

    // 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 ComGetMHT Of hoMht "http://www.google.com/" To sMhtStr
    Get ComLastMethodSuccess Of hoMht To bTemp1
    If (bTemp1 <> True) Begin
        Get ComLastErrorText Of hoMht To sTemp1
        Showln sTemp1

    End
    Else Begin
        Showln sMhtStr
    End



End_Procedure