I'm having trouble updating a richedit control from a thread.
Code:
HWND *rawr = new HWND;
*rawr = GetDlgItem(hwnd, IDC_MAIN_EDIT);
hThread= CreateThread(0, 0, ThreadFunc, rawr, 0,&dwThreadID);
Code:
DWORD WINAPI ThreadFunc(LPVOID data)
{
HWND *rawr = static_cast<HWND *>(data);
CHARRANGE cr;
cr.cpMin = -1;
cr.cpMax = -1;
SendMessage(*rawr, EM_EXSETSEL, 0, (LPARAM)&cr);
SendMessage(*rawr, EM_REPLACESEL, 0,(LPARAM)"hey look some text");
return 0;
}
What's wrong with that code?
Using dev-cpp on win2k if that matters.
Thanks,
Berto
edit: I suck at the vbcode