字符变乱码 新手请教
我是在下编译的case WM_DRAWITEM://系统需要对其进行绘制时
{
ds=(DRAWITEMSTRUCT*)lParam;
HDC hdc=(HDC)ds->hDC;
RECT rc=ds->rcItem;
TCHAR Text[40];
//选项
if(wParam==IDC_LIST1)
{
HDC hmdc=CreateCompatibleDC((HDC)hdc);
RECT rc=ds->rcItem;
//写文字
SetBkMode(hdc,TRANSPARENT);
SendMessage(ds->hwndItem,LB_GETTEXT,ds->itemID,(LPARAM)Text);
DrawText(hdc,Text,-1,&rc,DT_VCENTER|DT_LEFT|DT_SINGLELINE);
/* SetBkMode(hdc,TRANSPARENT);
sprintf(Text,"%d",ds->itemID+1);
DrawText(hdc,Text,-1,&rc,DT_VCENTER|DT_LEFT|DT_SINGLELINE);*/
}
}
break;
case WM_MEASUREITEM:
{
ms1=(MEASUREITEMSTRUCT*)lParam;
ms1->itemHeight=50;
return 0;
}
break;
而我在初始化的时候 定义:
TCHAR szText[26][32] =
{
L" ", L"B-2", L"B-3", L"B-17[25 meters]", L"B-17[50 meters]", L"B-37", L"MR-31", L"SR-21", L"Rifle A", L"IPSC Metric[26 meters]", L"25-Yard AQT",
L"T-50X", L"50M Smallbore prone", L"B-11", L"B-40", L"ELK", L"BIATHLON Stand", L"BIATHLON Prone", L"B-27[25 yards]", L"B-27[50 yards]", L"AR-5[10 meters]",
L"A-17[50 feet]", L"A-32[50 feet]", L"A-50[50 meters]",L"MAN at 25 yards",L"MAN at 10 yards"
};
我想实现的功能是listbox里面最后显示szText的数据,编译没有问题,就是listbox中显示乱码,请各位多帮忙