Archived Forum Post

Index of archived forum posts

Question:

put_EventCallbackObject compile error

Apr 29 '14 at 17:04

Hi

Using VC2013 and the latest libraries. I have this code:

CMyFtpTransferZipProgress ftpProgress(&m_wndStatusBar, strTarget); ftp.put_EventCallbackObject(&ftpProgress);

I updated CMyFtpTransferZipProgress to inherit from CkFtp2Progress and did a full rebuild but I still get an error:

4>MainFrm.cpp(2773): error C2664: 'void CkFtp2W::put_EventCallbackObject(CkFtp2ProgressW )' : cannot convert argument 1 from 'CMyFtpTransferZipProgress ' to 'CkFtp2ProgressW *'

I have followed:

http://www.chilkatsoft.com/refdoc/vcCkFtp2Doc.html#eventsOverview

Thanks.

Andrew


Answer

If using the wide-char version of the Chilkat class (i.e. the one ending with a "W", such as CkFtp2W), then use the wide-char version of the event callback class.

You'll find it in the CkFtp2ProgressW.h header file.

Also:

/*

To receive progress events (callbacks), create a C++ class that inherits this one and provides one or more overriding implementations for the events you wish to receive.

*/

// When creating an application class that inherits the CkFtp2ProgressW base class, use the CK_FTP2PROGRESSW_API // definition to declare the overrides in the class header. This has the effect that if for // some unforeseen and unlikely reason the Chilkat event callback API changes, or if new // callback methods are added in a future version, then you'll discover them at compile time // after updating to the new Chilkat version.
// For example: /* class MyProgress : public CkFtp2ProgressW { public: CK_FTP2PROGRESSW_API

...
};

/ #define CK_FTP2PROGRESSW_API void BeginDownloadFile(const wchar_t pathUtf8, bool skip); void EndDownloadFile(const wchar_t pathUtf8, int64 numBytes); void VerifyDownloadDir(const wchar_t pathUtf8, bool skip); void BeginUploadFile(const wchar_t pathUtf8, bool skip); void EndUploadFile(const wchar_t *pathUtf8, int64 numBytes); void VerifyUploadDir(const wchar_t pathUtf8, bool skip); void VerifyDeleteDir(const wchar_t pathUtf8, bool skip); void VerifyDeleteFile(const wchar_t pathUtf8, bool skip); void UploadRate(int64 byteCount, unsigned long bytesPerSec); void DownloadRate(int64 byteCount, unsigned long bytesPerSec);