CRichEditCtrl::StreamIn error codes
Does anyone know the meaning of the error codes of CRichEditCtrl::StreamIn
?
I use the following code to insert formatted text into my control, and sometimes I get an error code like开发者_开发技巧 -16 back.
EDITSTREAM es;
es.dwError = 0;
es.dwCookie = (DWORD) &mf; // mf is a CMemFile
es.pfnCallback = RtfStreamInCallback; // this is my callback
pRichEditCtrl->StreamIn(nFormat,es);
After the call to StreamIn, es.dwError = -16. But WTH does that mean?
The error code is the return value from your callback function.
See the section on Return Value in the MSDN entry for EditStreamCallback:
Return value Type: DWORD The callback function returns zero to indicate success. The callback function returns a nonzero value to indicate an error. If an error occurs, the read or write operation ends and the rich edit control discards any data in the pbBuff buffer. If the callback function returns a nonzero value, the rich edit control uses the dwError member of the EDITSTREAM structure to pass the value back to the application.
http://msdn.microsoft.com/en-US/library/bb774368(v=VS.85).aspx
精彩评论