Sample code for 30+ languages & platforms
Unicode C

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 Unicode C Downloads

Unicode C
#include <C_CkMhtW.h>

void ChilkatSample(void)
    {
    HCkMhtW mht;
    const wchar_t *mhtStr;

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

    mht = CkMhtW_Create();

    mhtStr = CkMhtW_getMHT(mht,L"http://www.google.com/");
    if (CkMhtW_getLastMethodSuccess(mht) != TRUE) {
        wprintf(L"%s\n",CkMhtW_lastErrorText(mht));

    }
    else {
        wprintf(L"%s\n",mhtStr);
    }



    CkMhtW_Dispose(mht);

    }