HWND hwndlist=GetDlgItem(hwnd,IDC_LIST1);
//LVCOLUMN col;
//int nret=0;
//int colnum=0;

//col.mask=LVCF_FMT  | LVCF_TEXT ;
//col.fmt=LVCFMT_LEFT;
//col.cx=68;
//col.pszText = "ttt";
//col.cchTextMax=sizeof("ttt");
//col.iSubItem =0;
//ListView_InsertColumn(hwndlist,0,&col);
ListView_SetItemCount (hwndlist, 0);
LVITEMA lvitem;
lvitem.mask =LVIF_TEXT;
lvitem.iItem=0;
lvitem.pszText="tttttttttt";
ListView_InsertItem(hwndlist,&lvitem);
ListView_SetItem(hwndlist,&lvitem);为什么不能用,我不想要column??

解决方案 »

  1.   

    kao,不想要column, 那当然是空的了,
    你要的应该是要一个column吧.
      

  2.   

    HWND hwndlist=GetDlgItem(hwnd,IDC_LIST1);
    LVCOLUMN col;
    //int nret=0;
    //int colnum=0;

    col.mask=LVCF_FMT  | LVCF_TEXT ;
    col.fmt=LVCFMT_LEFT;
    col.cx=68;
    col.pszText = "ttt";
    col.cchTextMax=sizeof("ttt");
    //col.iSubItem =0;
    ListView_InsertColumn(hwndlist,0,&col);
    ListView_SetItemCount (hwndlist,1);
    LVITEMA lvitem;
    lvitem.mask =LVIF_TEXT;
    lvitem.iItem=0;
    lvitem.pszText="tttttttttt";
    ListView_InsertItem(hwndlist,&lvitem);
    ListView_SetItem(hwndlist,&lvitem);为什么这样LIST1还是空的呢?
      

  3.   

    看看你的
    ListView_InsertColumn(hwndlist,0,&col);
    返回.
    看看这个是啥意思LVS_NOCOLUMNHEADER
      

  4.   

    HWND hwndlist=GetDlgItem(hwnd,IDC_LIST1);
    LVCOLUMN col;
    int nret=0;
    //int colnum=0;
    TCHAR strtt[12];
    col.mask=LVCF_FMT  | LVCF_TEXT ;
    col.fmt=LVCFMT_LEFT;
    col.cx=168;
    col.pszText = "ttt";
    col.cchTextMax=sizeof("ttt");
    //col.iSubItem =0;
    nret=ListView_InsertColumn(hwndlist,0,&col);

    wsprintf(strtt,"%d",nret);
    MessageBox(NULL,strtt,"",MB_OK);
    ListView_SetItemCount (hwndlist,1);
    LVITEM lvitem;
    lvitem.mask =LVIF_TEXT;
    lvitem.iItem=0;
    lvitem.pszText="tttttttttt";
    ListView_InsertItem(hwndlist,&lvitem);
    ListView_SetItem(hwndlist,&lvitem);只有column却没有item
      

  5.   

    I fu了 u.HWND hwndlist=GetDlgItem(hwnd,IDC_LIST1);LVCOLUMN col;
    col.mask = LVCF_FMT  ¦ LVCF_TEXT ;
    col.fmt  = LVCFMT_LEFT;
    col.cx   = 168;
    col.pszText = "ttt";
    ListView_InsertColumn(hwndlist,0, &col);LVITEM lvitem;
    lvitem.mask     = LVIF_TEXT;
    lvitem.iItem    = 0;
    lvitem.iSubItem = 0;
    lvitem.pszText  = "tttttttttt";
    ListView_InsertItem(hwndlist,&lvitem);