Archived Forum Post

Index of archived forum posts

Question:

Event callbacks in CkDecryptFile not working as expected

Oct 28 '13 at 11:43

I cannot get void PercentDone(int pctDone, bool abort) and void ProgressInfo(const char name, const char *value) event callbacks to work with CkCrypt2Progress in C++. In e.g. CkZipProgress these callbacks work just fine.

I have tried to lower the put_HeartbeatMs to e.g. 2ms, but still no difference. However the void AbortCheck(bool *abort) callback works fine. I have also tried with different file sizes (just-in-case).

I am using the VC++ 11 / 32bit / v110_xp libraries version 9.4.1.47.

My derived code looks like this:

#include "CkCrypt2Progress.h"
#include "ProgressDualDlg.h"

class Crypt2Progress : public CkCrypt2Progress  
{
public:
    CProgressDualDlg *localDlg;
    Crypt2Progress(CProgressDualDlg *dlg) : localDlg(dlg)   { }
    virtual ~Crypt2Progress() { }

    void AbortCheck(bool *abort) 
    { 
        if (localDlg->IsStopped()) <-- breakpoint hit
        {
            *abort = true;
        }
    }
    void PercentDone(int pctDone, bool *abort)
    {
        if (localDlg->IsStopped()) <-- breakpoint never hit
        {
            *abort = true;
        }
        localDlg->SetPos(pctDone);
        localDlg->Pump();
    }

    void ProgressInfo(const char *name, const char *value)
    {
        CString csName(name); <-- breakpoint never hit
        CString csValue(value);
    }
};

Accepted Answer

These new builds should fix the problem with PercentDone not getting called:

32-bit: http://www.chilkatsoft.com/preRelease/chilkat-9.4.1-x86-vc11_xp.zip

64-bit: http://www.chilkatsoft.com/preRelease/chilkat-9.4.1-x86_64-vc11_xp.zip

The PercentDone will also count as an AbortCheck event, therefore the AbortCheck events will only be called when enough time elapses between 1% increments.

There are no actual ProgressInfo events in this case, so it won't fire.