Sample code for 30+ languages & platforms
PureBasic

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 PureBasic Downloads

PureBasic
IncludeFile "CkMht.pb"

Procedure ChilkatExample()

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

    mht.i = CkMht::ckCreate()
    If mht.i = 0
        Debug "Failed to create object."
        ProcedureReturn
    EndIf

    mhtStr.s = CkMht::ckGetMHT(mht,"http://www.google.com/")
    If CkMht::ckLastMethodSuccess(mht) <> 1
        Debug CkMht::ckLastErrorText(mht)

    Else
        Debug mhtStr
    EndIf



    CkMht::ckDispose(mht)


    ProcedureReturn
EndProcedure