Using a callback function name as an argument in a function
- From: "Dan Gistenson" <d.gistenson@xxxxxxxxxxxxx>
- Date: Tue, 15 Jan 2008 17:49:00 -0600
Hi.
Can someone tell me where I'm going wrong with this problem in my vc6 mfc
sdi project, and tell me how to fix it? I understand the general meaning of
the compiler's 2664 error message, but I don't understand what's wrong with
my approach and how to fix it. The problem lies with argument 3 of
lineInitializeEx() and/or the prototype and definition of
lineCallbackFunc().
I used Class wizard to add the member function lineCallbackFunc() to my doc
class. The function will be used as a callback function, by using it as the
third argument in a call to lineInitializeEx() which I hav placed in the
OnNewDocument member function of my doc class.
The compiler error message, the prototype and definition of the callback
function, and the call to lineInitializeEx() are below, in that order. What
am I doing wrong, and how do I fix it?
The compiler error message is:
error C2664: 'lineInitializeExA' : cannot convert parameter 3 from 'void
(unsigned long,unsigned long,unsigned long,unsigned long,unsigned
long,unsigned long)' to 'void (__stdcall *)(unsigned long,unsigned
long,unsigned long,unsigned long,unsigned long,unsigned long)'
None of the functions with this name in scope match the target type
The callback function's prototype is:
void lineCallbackFunc(DWORD hDevice, DWORD dwMsg, DWORD dwCallbackInstance,
DWORD dwParam1, DWORD dwParam2, DWORD dwParam3);
The callback function's definition is:
void CFoneIODoc::lineCallbackFunc (DWORD hDevice, DWORD dwMsg, DWORD
dwCallbackInstance,
DWORD dwParam1, DWORD dwParam2, DWORD dwParam3)
{
// My code will go here.
}
Finally, the call to lineInitializeEx() is: (Argument 3 is the issue.)
lResult = lineInitializeEx( &hLineApp, NULL, lineCallbackFunc, "TAPI App!",
&dwNumDevs, &dwHighApiVersion, &lineInit );
Please help.
Thanks,
Dan
.
- Follow-Ups:
- Re: Using a callback function name as an argument in a function
- From: Giovanni Dicanio
- Re: Using a callback function name as an argument in a function
- From: AliR \(VC++ MVP\)
- Re: Using a callback function name as an argument in a function
- From: Kerem Gümrükcü
- Re: Using a callback function name as an argument in a function
- From: Jonathan Wood
- Re: Using a callback function name as an argument in a function
- Prev by Date: Re: Programmatically holding down control
- Next by Date: Re: Owner draw repaint
- Previous by thread: how to display a bargraph in my new dialog app.
- Next by thread: Re: Using a callback function name as an argument in a function
- Index(es):
Relevant Pages
|