I decided to turn my win32 C ++ application into a Unicode version, but when I use this, I received unreadable letters for Arabic, Chinese and Japanese ...
Firstly:
If I do not use Unicode, I got Arabic in the edit windows. Window titles:
HWND hWnd = CreateWindowEx(WS_EX_CLIENTEDGE, "Edit", "ا ب ت ث ج ح خ د ذ", WS_CHILD | WS_VISIBLE | WS_BORDER | ES_MULTILINE, 10, 10, 300, 200, hWnd, (HMENU)100, GetModuleHandle(NULL), NULL);
SetWindowText(hWnd, "صباح الخير");
The output seems fine and works fine! (without unicode).
I added before the inclusion headers:
#define UNICODE
#include <windows.h
Now in the Procedure window:
case WM_CREATE:{
HWND hEdit = CreateWindowExW(WS_EX_CLIENTEDGE, L"Edit", L"ا ب ت ث ج ح خ د ذ", WS_CHILD | WS_VISIBLE | WS_BORDER | ES_MULTILINE, 10, 10, 300, 200, hWnd, (HMENU)100, GetModuleHandle(NULL), NULL);
}
break;
case WM_LBUTTONDBLCLK:{
SendDlgItemMessageW(hWnd, 100, WM_SETTEXT, 0, (LPARAM)L"السلام عليكم");
}
break;
As you can see in Unicode, controls cannot correctly display Arabic characters.
- The fact is: after creating the control, I delete the contents manually using
backspace
Now, if I enter the Arabic text manually. Successfully display it correctly? !!! But why does Wen use features? How SetWindowTextW()
??
, . .