I try to put datas to my RichEdit50W but it doesn't work. I really need help.
My function CreateRichEdit :
void CreateRichEdit(HWND hwndOwner, int x, int y, int width, int height, HINSTANCE hinst)
{
LoadLibrary(TEXT("Msftedit.dll"));
edittext = CreateWindowEx(0, TEXT("RICHEDIT50W"), TEXT("Type here"), ES_MULTILINE | WS_VISIBLE | WS_CHILD | WS_BORDER | WS_TABSTOP | ES_AUTOVSCROLL | WS_VSCROLL,
x, y, width, height,
hwndOwner, NULL, hinst, 0);
char * bidule = "coucou c'est moi";
EDITSTREAM es = { 0 };
es.dwCookie = (DWORD_PTR)bidule;
es.dwError = 0;
es.pfnCallback = EditStreamInCallback;
bool ok = false;
if (SendMessage(edittext, EM_STREAMIN, SF_RTF, (LPARAM)&es) == 0) {
ok = true;
}
}
And in my function EditStreamInCallback, in my variable 'txt', I well get the text "coucou c'est moi". But after, when I try to write in pbBuff , I don't see the result in my rich textbox:
DWORD CALLBACK EditStreamInCallback(DWORD_PTR dwCookie, LPBYTE pbBuff, LONG cb, LONG * pcb)
{
if (!cb)
return (1);
char * txt = (char *) dwCookie;
int i;
for (i = 0; i < 3; i++)
{
*(pbBuff + i) = 'a';
}
*(pbBuff + i) = '\0';
*pcb = 3;
return (0);
}
I absolutely need help ! Do you have any solution please ?
Thank you in advance