EldoS | Feel safer!

Software components for data protection, secure storage and transfer

Error C2664 When registering a callback function (C++)

Also by EldoS: BizCrypto
Components for BizTalk® and SQL Server® Integration Services that let you securely store and transfer information in your business automation solutions.
#17824
Posted: 10/11/2011 17:25:33
by Ophir Yoktan (Basic support level)
Joined: 08/21/2011
Posts: 7

I get a strange compilation error when attempting to register a call back function

The function definition:
Code

void OpenFileEventCHandler(CallbackFilter* Sender, LPCWSTR FileName, DWORD* DesiredAccess, WORD* FileAttributes, WORD* ShareMode, DWORD* Options, WORD* CreateDisposition, LPBOOL RequestAccepted);


The callback registration:
Code
CallbackFilter filter;
...
filter.SetOnOpenFileC(OpenFileEventCHandler);


The error message:
Code

1>MediaFilterConsole.cpp(35): error C2664: 'CallbackFilter::SetOnOpenFileC' : cannot convert parameter 1 from 'void (__cdecl *)(CallbackFilter *,LPCWSTR,DWORD *,WORD *,WORD *,DWORD *,WORD *,LPBOOL)' to 'CbFltOpenFileEventC'
1>          None of the functions with this name in scope match the target type


any ideas?
#17825
Posted: 10/11/2011 23:30:11
by Eugene Mayevski (EldoS Corp.)

Do you have the same problem with the sample project?


Sincerely yours
Eugene Mayevski
#17826
Posted: 10/11/2011 23:34:49
by Ophir Yoktan (Basic support level)
Joined: 08/21/2011
Posts: 7

The sample projects do compile, but I couldn't find a difference between the two.

Ophir
#17827
Posted: 10/12/2011 00:00:06
by Eugene Mayevski (EldoS Corp.)

Most likely the problem is not in source code, but in project settings. Check if you have Unicode being enabled or disabled in the sample and try using the same setting in your code.


Sincerely yours
Eugene Mayevski
#17831
Posted: 10/12/2011 07:54:59
by Ophir Yoktan (Basic support level)
Joined: 08/21/2011
Posts: 7

Solved (at least the program compiles)

The function prototype I used (based on the help file) had LPCWSTR (const wide string )for file name, and the examples use LPWSTR (mutable wide string)
#17837
Posted: 10/12/2011 08:42:20
by Eugene Mayevski (EldoS Corp.)

Thank you, we've fixed documentation.


Sincerely yours
Eugene Mayevski
Also by EldoS: Rethync
The cross-platform framework that simplifies synchronizing data between mobile and desktop applications and servers and cloud storages

Reply

Statistics

Topic viewed 2498 times

Number of guests: 1, registered members: 0, in total hidden: 0




|

Back to top

As of July 15, 2016 EldoS Corporation will operate as a division of /n software inc. For more information, please read the announcement.

Got it!