I'm doing a desktop app using winapi.
It only happens whenever I try to do it with variables, whenever I pass just text, everything works correctly.
I tried switching out SendMessageW for SendMessageA, but the strings are still displayed wrong. When the text is put in, it is displayed correctly only with SendMessageA and not SendMessageW.
case WM_COMMAND:
switch (LOWORD(wParam))
{
case 2:
GetWindowTextA(TextBox, &text[0], len);
wstring tst = L"test";
SendMessage(TextField, EM_SETSEL, 0, -1);
SendMessageA(TextField, EM_REPLACESEL, 0, (LPARAM)&tst);
delete[] text;
SetWindowText(TextBox, L"");
break;
}
And here I just put text instead and it works perfectly fine
SendMessageA(TextField, EM_REPLACESEL, 0, (LPARAM)"test");