// Initialize the LVCOLUMN structure.
// The mask specifies that the format, width, text, and subitem members
// of the structure are valid.
lvc.mask = LVCF_FMT | LVCF_WIDTH | LVCF_TEXT | LVCF_SUBITEM;
// Add the columns
for (iCol = 0; iCol < NumOfFields; iCol++)
{
lvc.iSubItem = iCol;
strcpy(szText, "");
strcpy(szText,sql.fields[iCol].name);
lstrcpy(szText_t, L"");
mbstowcs(szText_t, szText, strlen(szText)+1);
lvc.pszText = szText_t;
lvc.cx = 100; // width of column in pixels
// Some code to create the list-view control.
// Initialize LVITEM members that are common to all items.
lvi.mask = LVIF_TEXT | LVIF_IMAGE | LVIF_PARAM | LVIF_STATE;
lvi.state = 0;
lvi.stateMask = 0;
// Initialize LVITEM members that are different for each item.