我將Character set
設置爲Use Unicode Character Set
但是當顯示窗口時,其標題仍然具有方形字符。我該如何解決它?謝謝!爲什麼我不能在Win32中啓用unicode編輯控件?
#include <windows.h>
LRESULT CALLBACK WinProc(HWND, UINT, WPARAM, LPARAM);
int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, LPSTR lpCmdLine, int nShowCmd)
{
WNDCLASSEX wClass;
ZeroMemory(&wClass, sizeof(WNDCLASSEX));
wClass.cbClsExtra = NULL;
wClass.cbSize = sizeof(WNDCLASSEX);
wClass.cbWndExtra = NULL;
wClass.hbrBackground = (HBRUSH)COLOR_WINDOW;
wClass.hCursor = LoadCursor(NULL, IDC_ARROW);
wClass.hIcon = NULL;
wClass.hIconSm = NULL;
wClass.hInstance = hInst;
wClass.lpfnWndProc = (WNDPROC)WinProc;
wClass.lpszClassName = L"Window Class";
wClass.lpszMenuName = NULL;
wClass.style = CS_HREDRAW | CS_VREDRAW;
RegisterClassEx(&wClass);
HWND hWnd = CreateWindowEx(
NULL,
L"Window Class",
L"/ce 但是,這樣做並不能保證在對話框編輯器創建控件之前將加載所需的庫。",
WS_OVERLAPPEDWINDOW,
200, 200, 300, 0, NULL, NULL, hInst, NULL);
ShowWindow(hWnd, nShowCmd);
MSG msg;
ZeroMemory(&msg, sizeof(MSG));
while (GetMessage(&msg, NULL, 0, 0))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
return 0;
}
LRESULT CALLBACK WinProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
switch (msg)
{
case WM_DESTROY:
PostQuitMessage(0);
return 0;
break;
}
return DefWindowProc(hWnd, msg, wParam, lParam);
}
這是字體的問題。您需要一個包含您要顯示的字符的字形的字體。 –
@ R.MartinhoFernandes:對不起,我是C++和Win32的新手,你能告訴我怎麼做嗎? – Sakura
你知道你正在創建自己的窗口類,而不是使用編輯控件的現有窗口類?這很重要 - 對於你的窗戶,你負責字體。 – MSalters