往列表框裏插入數據

////////////////////////////
void SSS::SetCell(HWND hWnd1, CString value, int nRow, int nCol)
{
 TCHAR     szString [256];
 wsprintf(szString,value ,0);

 //Fill the LVITEM structure with the values given as parameters.
 LVITEM lvItem;
 lvItem.mask = LVIF_TEXT;
 lvItem.iItem = nRow;
 lvItem.pszText = szString;
 lvItem.iSubItem = nCol;
 if(nCol >0)
 //set the value of listItem
 ::SendMessage(hWnd1,LVM_SETITEM, (WPARAM)0,(WPARAM)&lvItem);
 else
 //Insert the value into List
 ListView_InsertItem(hWnd1,&lvItem);
}

SetCell(::GetDlgItem (m_hWnd,IDC_LIST1),nr,pNMListView->iItem, pNMListView->iSubItem);//設置第Index行,第C_L列的值.

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章