Sample code for 30+ languages & platforms
Unicode C

Transition from MailMan.LoadMbx to MailMan.LoadMbxFile

Provides instructions for replacing deprecated LoadMbx method calls with LoadMbxFile.

Chilkat Unicode C Downloads

Unicode C
#include <C_CkMailManW.h>
#include <C_CkEmailBundleW.h>

void ChilkatSample(void)
    {
    BOOL success;
    HCkMailManW mailman;
    const wchar_t *filePath;
    HCkEmailBundleW bundleObj;
    HCkEmailBundleW bundleOut;

    success = FALSE;

    mailman = CkMailManW_Create();

    //  ...
    //  ...

    filePath = L"c:/test/example.mbx";

    //  ------------------------------------------------------------------------
    //  The LoadMbx method is deprecated:

    bundleObj = CkMailManW_LoadMbx(mailman,filePath);
    if (CkMailManW_getLastMethodSuccess(mailman) == FALSE) {
        wprintf(L"%s\n",CkMailManW_lastErrorText(mailman));
        CkMailManW_Dispose(mailman);
        return;
    }

    //  ...
    //  ...

    CkEmailBundleW_Dispose(bundleObj);

    //  ------------------------------------------------------------------------
    //  Do the equivalent using LoadMbxFile.
    //  Your application creates a new, empty EmailBundle object which is passed 
    //  in the last argument and filled upon success.

    bundleOut = CkEmailBundleW_Create();
    success = CkMailManW_LoadMbxFile(mailman,filePath,bundleOut);
    if (success == FALSE) {
        wprintf(L"%s\n",CkMailManW_lastErrorText(mailman));
        CkMailManW_Dispose(mailman);
        CkEmailBundleW_Dispose(bundleOut);
        return;
    }



    CkMailManW_Dispose(mailman);
    CkEmailBundleW_Dispose(bundleOut);

    }