我的状态栏的代码在这里:
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");
设置状态栏文本的底部方式中的任何一个都只会出现像字符一样的乱码中文
答案 0 :(得分:1)
以下行存在问题
SetWindowText(hStatus, (LPCWSTR)"sdgsdfgd");
应该是
SetWindowTextW(hStatus, L"sdgsdfgd");
所有这些都取决于窗口是UNICODE还是ANSI。