我制作状态栏的代码在这里:
int statwidths[] = {300, -1};
HWND hStatus;
hStatus = GetDlgItem(hWnd, IDC_MAIN_STATUS);
SendMessage(hStatus, WM_SIZE, 0, 0);
hStatus = CreateWindowEx(0, STATUSCLASSNAME, NULL,
WS_CHILD | WS_VISIBLE | SBARS_SIZEGRIP, 20, 20, 20, 5,
hWnd, (HMENU)IDC_MAIN_STATUS, GetModuleHandle(NULL), NULL);
SendMessage(hStatus, SB_SETPARTS, sizeof(statwidths)/sizeof(int), (LPARAM)statwidths);
//SendMessage(hStatus, SB_SETTEXT, 0, (LPARAM)"Loading things...");
SetWindowText(hStatus, (LPCWSTR)"sdgsdfgd");
设置状态栏文本的两种底部方法之一都只能显示乱码的中文字符
最佳答案
下一行有问题
SetWindowText(hStatus, (LPCWSTR)"sdgsdfgd");
它应该是
SetWindowTextW(hStatus, L"sdgsdfgd");
所有这些还取决于窗口是UNICODE还是ANSI。