我将Character set
设置为Use Unicode Character Set
但是在显示窗口时,其标题仍然是方形字符。我该如何解决?谢谢!
#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);
}
答案 0 :(得分:1)
我发布这个作为答案,只是因为我无法将图片放在评论中......
我刚刚做了你所做的,相同的代码,Windows 8.1 x64 VS2012英国英语,这是我得到的结果:
除非你忽略了将源文件保存为UNICODE文件的提示,否则你应该得到相同的结果 - 除非你的Region / Language部分有一些奇怪的设置,否则我没有看到任何其他差异。控制面板。
如果仍然遇到问题,则必须仔细检查所有设置,并发布更多代码和/或转储编译器命令行。