下面我创建listview的部分代码
{
LPSTR pText[2] = { "InfoLog", "ErrLog"};
LVCOLUMN lvc;
int iCol;
lvc.mask = LVCF_FMT | LVCF_WIDTH | LVCF_TEXT | LVCF_SUBITEM;
for (iCol = 0; iCol < 2/*C_COLUMNS*/; iCol++)
{
lvc.iSubItem = iCol;
lvc.pszText = (LPSTR)pText[iCol];
lvc.cx = 100; // Width of column in pixels.
if ( iCol < 2 )
lvc.fmt = LVCFMT_LEFT; // Left-aligned column.
else
lvc.fmt = LVCFMT_RIGHT; // Right-aligned column.
if (ListView_InsertColumn(hWndListView, iCol, &lvc) == -1)
return FALSE;
}
return TRUE;
}