Documentation for values in EDITSTREAM es.dwError?
Does anyone know where the error return values for the EM_STREAMIN message
might be documented? Here's a snippet of code from an application which uses
EM_STREAMIN to load an RTF file:
/* condition sf_flags for insert */
DWORD dwFlags = SF_RTF | SFF_SELECTION;
/* Initialize EDITSTREAM structure */
EDITSTREAM es;
ZeroMemory ((PVOID) &es, sizeof (EDITSTREAM));
es.dwCookie = (DWORD) hFile; // Send hFile to callback function
es.dwError = 0;
es.pfnCallback = ReadScriptCallback;
/* shut off notification messages during read */
DWORD dwOldEventMask = (DWORD) SendMessage (hwndRe, EM_SETEVENTMASK, 0,
(LPARAM) 0);
/* stream in text */
DWORD dwRetv = (DWORD) SendMessage (hwndRe, EM_STREAMIN, (WPARAM) dwFlags,
(LPARAM) &es);
/* store GetLastError() before calling anything else that might reset erret */
DWORD dwLocalErret = GetLastError ();
/* Close the file */
CloseHandle (hFile);
/* Reset EVENTMASK to its previous value */
SendMessage (hwndRe, EM_SETEVENTMASK, 0, (LPARAM) dwOldEventMask);
/* attempt to detect errors from EM_STREAMIN */
if (dwRetv == 0 || es.dwError != 0)
{
*erret = TNR_FILE_ERROR_OPSYSERR;
/* This is an error logging function */
MIMessageDisplay (EPF_ERR, TEXT("(Line %d: Error %08X) system error = %d,
es.dwError = %d, streaming in %s"),
__LINE__, *erret, dwLocalErret, es.dwError, fname);
return FALSE;
}
*erret = TNR_FILE_ERROR_NONE;
return TRUE;
// end of code snippet
This snippet is from an application which has loaded in the neighborhood of
tens of thousands of files during its life on the market -- normally, it
works fine. However, a recent script submitted by one of our customers causes
an unusual error return from the EM_STREAMIN message. The file's content
language is Dhivehi and as far as I can determine, the file is read
successfully.
According to Microsoft "documentation",
1. The return from SendMessage (hwndRe, EM_STREAMIN...) is "This message
returns the number of characters read." In this example, the return value is
0x3F1.
2. On return, es.dwError == 0xfffffffa (-6) . According to documentation:
"a value of zero indicates no error. A nonzero value can be the return
value of the EditStreamCallback function or a code indicating that the
control encountered an error."
The only possible return from our callback function is 0. This value (-6)
seems to have been set by the operating system and seems to indicate that an
error occurred in streaming.
However, the errors are undocumented, at least as far as I can tell.
Though I can ignore this error and continue, it seems a little chancy to
assume the resultant rich edit control is properly formatted.
Any assistance in documenting the return values would be appreciated.
Thanks!!!
date: Thu, 7 Aug 2008 11:28:01 -0700
author: AustinJstrings