Unicode text appears as a question mark in the edit box, although I use SetWindowTextW ()

I have a problem with unicode file names that appear in question marks in my fields.

When I insert Unicode characters in an edit box, such as Arabic or Thai, they are displayed correctly, but after running this code they become question marks. Why?

WCHAR buf[100];
GetWindowTextW(hWndEditBox, buf, 100);
SetWindowTextW(hWndEditBox, buf);

Another thing is the ANSI project (we have code that cannot be ported, so the whole project remains ANSI), that is, the _UNICODE macro is undefined, but I explicitly use the Unicode version of the file names.

+3
source share
2 answers

GetWindowText WM_GETTEXT (hWndEditBox). *A, *W ( , CreateWindowExA , ), , .

, , - , ANSI, , . , , (, ).

, GetWindowTextW SetWindowTextW, , - GetWindowTextW , , , .

, , . - Unicode.

: GetWindowText Raymond Chen .

+2

SetWindowTextW() fooobar.com/questions/1791940/...: WM_SETTEXT DefWindowProcW() DefWindowProc().

0

Source: https://habr.com/ru/post/1791937/


All Articles