API方式使用SendMessage添加ListCtrl列表控件 行与列数据
HWND hList = CreateWindowEx(NULL, TEXT("SysListView32"),
NULL, LVS_REPORT | WS_CHILD | WS_VISIBLE, 345, 440, 320, 120,
hwndDlg, NULL, (HINSTANCE)GetWindowLong(hwndDlg, GWL_HINSTANCE), NULL);
LV_COLUMN lvc;
lvc.mask = LVCF_TEXT | LVCF_WIDTH;
lvc.pszText = (LPWSTR)L"第1列";
lvc.cx = 100;
lvc.iSubItem = 0;
SendMessage(hList, LVM_INSERTCOLUMN, 0, (long)&lvc);
lvc.pszText = (LPWSTR)L"第2列";
lvc.cx = 50;
lvc.iSubItem = 1;
SendMessage(hList, LVM_INSERTCOLUMN, 1, (long)&lvc);
lvc.pszText = (LPWSTR)L"第3列";
lvc.cx = 80;
lvc.iSubItem = 2;
SendMessage(hList, LVM_INSERTCOLUMN, 2, (long)&lvc);
LVITEM Item;
Item.mask = LVIF_TEXT;
Item.iItem = 0; //行
Item.iSubItem = 0;//列
Item.pszText = (LPWSTR)L"1,1";
SendMessage(hList, LVM_INSERTITEM, 0, (LPARAM)&Item);
Item.iItem = 0;
Item.iSu