alexsendar 2017-01-26 04:00 采纳率: 100%
浏览 844
已采纳

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;

}
图片说明

  • 写回答

3条回答 默认 最新

  • alexsendar 2017-02-14 09:36
    关注

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

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(2条)

报告相同问题?

悬赏问题

  • ¥15 如何在3D高斯飞溅的渲染的场景中获得一个可控的旋转物体
  • ¥88 实在没有想法,需要个思路
  • ¥15 MATLAB报错输入参数太多
  • ¥15 python中合并修改日期相同的CSV文件并按照修改日期的名字命名文件
  • ¥15 有赏,i卡绘世画不出
  • ¥15 如何用stata画出文献中常见的安慰剂检验图
  • ¥15 c语言链表结构体数据插入
  • ¥40 使用MATLAB解答线性代数问题
  • ¥15 COCOS的问题COCOS的问题
  • ¥15 FPGA-SRIO初始化失败