The static DWORD CALLBACK
MyStreamOutCallback (DWORD dwCookie, LPBYTE pbBuff, LONG cb, LONG * PCB)
{
CFile * pFile=(CFile *) dwCookie;
PFile - & gt; Write (pbBuff, cb);
* PCB=cb;
return 0;
}
CFile CFile (TEXT (" myfile. RTF), CFile: : modeCreate | CFile: : modeWrite);
EDITSTREAM es.
Es. DwCookie=(DWORD) & amp; CFile;
Es. PfnCallback=MyStreamOutCallback;
M_richedit. StreamOut (SF_RTF, es);
After intercepting the compiled appear:
The error C2440: "=" : from "DWORD (__cdecl *) (DWORD, LPBYTE, LONG, LONG *)" into "EDITSTREAMCALLBACK
"This transformation requires the reinterpret_cast, C style transformation or function type conversion
The problem was with es. PfnCallback=MyStreamOutCallback; , could you tell me where there's a problem, how to change?
CodePudding user response:
Baidu search relevant keywords,Run into a similar problem is done with
/*... every time." */comment out different parts to recompile again, until orientation to the location of the specific grammatical errors, "
The methods to solve of,
CodePudding user response:
& MyStreamOutCallbackCodePudding user response:
To:static DWORD CALLBACK
MyStreamOutCallback (DWORD_PTR dwCookie, LPBYTE pbBuff, LONG cb, LONG * PCB)
{
CFile * pFile=(CFile *) dwCookie;
PFile - & gt; Write (pbBuff, cb);
* PCB=cb;
return 0;
}
CFile CFile (TEXT (" myfile. RTF), CFile: : modeCreate | CFile: : modeWrite);
EDITSTREAM es.
Es. DwCookie=(DWORD_PTR) & amp; CFile;
Es. PfnCallback=MyStreamOutCallback;
M_richedit. StreamOut (SF_RTF, es);
CodePudding user response:
In you there may not be the definition of EDITSTREAMCALLBACKTypedef dwords (CALLBACK * EDITSTREAMCALLBACK) (DWORD dwCookie, LPBYTE pbBuff, LONG cb, LONG * PCB);
But
Typedef dwords (CALLBACK * EDITSTREAMCALLBACK) (DWORD_PTR dwCookie, LPBYTE pbBuff, LONG cb, LONG * PCB);
CodePudding user response:
Is defined as an early version of it with a DWORD_PTREDITSTREAMCALLBACK callback function