You are here:

C++/Callback Functions

Advertisement


Question
Dear Sir
i got start working with VC++and Using Philips API to develope speech Application.
Philips API includes callback structures like
PSPDICTCBSTRUCT
Now this same Callback structure works f9 in win32 application.
But when i re-write same code in Buttons's click event i got error as
"   cannot convert from '' to 'void (__cdecl *)(unsigned long,unsigned long,long)'          "

on following line to initialize callback function as


PSPDICTCBSTRUCT cbDict= {0,0, OnDictationResult,0,0,0,0};

where decleration on OnDictationResult function is

OnDictationResult(PSPDICTRCGHANDLE i_handle, PSPDICTRESULTHANDLE i_result, PSPUSERDATA i_userData)




Now let me know is their any  setting in VC IDE are required to get callbacl function done in MFC ApplicationWizard(exe) type applications

Waiting for responce
Thanks in advance for all
regards
kashif gul kazi  

Answer
kashif, Thank you for your question.

Your declaration

OnDictationResult(PSPDICTRCGHANDLE i_handle, PSPDICTRESULTHANDLE i_result, PSPUSERDATA i_userData)

appears to be incorrect because you provide no return type for the function. All functions must have return types.

David Spector

C++

All Answers


Answers by Expert:


Ask Experts

Volunteer


David Spector

Expertise

Highly knowledgeable in the C++ language, Visual C++ (MSVC), Windows API, documentation and other quality-assurance techniques, and debugging. Knowledgeable in MFC, COM, GUI design, and object-oriented design.

Experience

I have been a software engineer since 1965. I have been published. My specializations have been: biomedical programming, compiler implementation, and many kinds of Windows programming. I don't do Databases or other business-oriented stuff.

Publications
Windows?/DOS Developer's Journal, ACM SIGPLAN Notices, and Computer Science Press.

Education/Credentials
ICCP Systems Programming Certification
Master's degree equivalent in Computer Science

©2016 About.com. All rights reserved.