I'm having a problem appending std::wstring
to my Win32 edit. It compiles without errors, but the displayed text is not what was originally in the std::wstring
. Is there a better way to do what I'm doing(below), or should I use the RichEdit(last resort option).
My appendTextToEdit function below is self-explanatory, It appends text to the edit. I think the problem lies in the second SendMessage call, where I cast newText
(LPCWSTR) to LPARAM
. Please advise
void appendTextToEdit( HWND Edit, LPCWSTR newText ){
int TextLen = SendMessage(hEdit, WM_GETTEXTLENGTH, 0, 0);
SendMessage(hEdit, EM_SETSEL, (WPARAM)TextLen, (LPARAM)TextLen);
SendMessage(hEdit, EM_REPLACESEL, FALSE, (LPARAM) newText);
}