DDE Client and PFNCALLBACK

W

WildHare

I am getting an error in a Windows Form which is supposed to be a DDEClient.

Error:
error C2440: 'type cast' : cannot convert from 'overloaded-function' to
'PFNCALLBACK'

Following are the pertinent areas of codes:

First we declare the prototype outside the Form Class:
HDDEDATA CALLBACK ddeCallback (UINT uType, UINT uFmt, HCONV hconv, HSZ hsz1,
HSZ hsz2, HDDEDATA hdata, DWORD dwData1, DWORD dwData2);

Then Inside the Form Class we do the following:
To start the DDE Client in Form_Load event handler is the following code:
iReturn = DdeInitialize(&idInst, (PFNCALLBACK) ddeCallback,
APPCLASS_STANDARD | APPCMD_CLIENTONLY, 0 );

Then an override method within the Form Class

HDDEDATA CALLBACK

ddeCallback (UINT uType, UINT uFmt, HCONV hconv,HSZ hsz1, HSZ hsz2, HDDEDATA
hdata,DWORD dwData1, DWORD dwData2)

{

return (HDDEDATA) NULL;

}


From everything I can tell, this should work. What have I
missed/forgotten/had a brain cramp about?

Thanks!
 
J

Julie

WildHare said:
I am getting an error in a Windows Form which is supposed to be a DDEClient.

Error:
error C2440: 'type cast' : cannot convert from 'overloaded-function' to
'PFNCALLBACK'

Following are the pertinent areas of codes:

First we declare the prototype outside the Form Class:
HDDEDATA CALLBACK ddeCallback (UINT uType, UINT uFmt, HCONV hconv, HSZ hsz1,
HSZ hsz2, HDDEDATA hdata, DWORD dwData1, DWORD dwData2);

Then Inside the Form Class we do the following:
To start the DDE Client in Form_Load event handler is the following code:
iReturn = DdeInitialize(&idInst, (PFNCALLBACK) ddeCallback,
APPCLASS_STANDARD | APPCMD_CLIENTONLY, 0 );

Then an override method within the Form Class

HDDEDATA CALLBACK

ddeCallback (UINT uType, UINT uFmt, HCONV hconv,HSZ hsz1, HSZ hsz2, HDDEDATA
hdata,DWORD dwData1, DWORD dwData2)

{

return (HDDEDATA) NULL;

}

From everything I can tell, this should work. What have I
missed/forgotten/had a brain cramp about?

Thanks!

ddeCallback has to either be a static member function or not part of your
class.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top