Archived Forum Post

Index of archived forum posts

Question:

Using the events call back

May 09 '14 at 15:53

Hi I am very confused. I am using VS2013 MFC MDI application. The progress monitoring does not seem to be fired. I am doing it like this:

CMyFtpTransferZipProgress ftpProgress(&m_wndStatusBar, strTarget); ftp.put_HeartbeatMs(200); ftp.put_EventCallbackObject(&ftpProgress); bOK = ftp.PutFile(strTempFile, strTarget); ftp.put_EventCallbackObject(NULL);

The class used to work in VS2005. I am using 9.5 version libraries. I get no errors. The files get loaded. Even tested with a 100 mb file.

Andrew


Answer

Andrew, some event callbacks changed in v9.5.0:

C++ event callbacks have been modified to used 64-bit integers where appropriate (CkZipProgress, and others). When using inheritance for event callbacks, such as w/ C++, check to make sure your derived class matches the method signatures that are now 64-bit. One way to ensure that your event callback classes correctly match the base class method signatures is to declare methods using the #define’s found in the Ck*Progress.h headers.

See the online reference documentation, or the Ck*Progress.h headers themselves.

If the methods in your class do not match the methods in the base class, then the methods in the base class are not overridden -- and this would cause the problem.


Answer

Hi

I have checked the headers and the declaration:

define CK_BASEPROGRESSW_API \

void AbortCheck(bool *abort);\
void PercentDone(int pctDone, bool *abort);\
void ProgressInfo(const wchar_t *name, const wchar_t *value);

I see it is called PercentDone instead of FtpPercentDone and passes int instead of long.

Will try!

Andrew