win32开发 1.我创建了7个listview,下面是代码,为什么没有名字?

2.怎么根据这7个按钮的点击来执行相应得函数?

BOOL CFileOpt::InitListViewColumns(HWND hWndListView)
{
WCHAR szText[256] = L"abc"; // Temporary buffer.
LVCOLUMN lvc;
int iCol;

// 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 < 7/*C_COLUMNS*/; iCol++)
{
    lvc.iSubItem = iCol;
    lvc.pszText = (LPSTR)szText;
    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.

    // Load the names of the column headings from the string resources.
    LoadString(m_hInst,
        /*IDS_FIRSTCOLUMN*/NULL + iCol,
        (LPSTR)szText,
        sizeof(szText)/sizeof(szText[0]));

    // Insert the columns into the list view.
    if (ListView_InsertColumn(hWndListView, iCol, &lvc) == -1)
        return FALSE;
}

return TRUE;

}
图片说明

删除loadstring语句,就可以显示名字。

直接添加OnColumnclickList响应,根据条目索引if就行了

LoadString(m_hInst,
/*IDS_FIRSTCOLUMN*/NULL + iCol,
(LPSTR)szText,
sizeof(szText)/sizeof(szText[0]));

你资源里有这些字符串么