LVM_INSERTITEM I cannot make head or tail of it.
hello all,
is there another way to insert ListView Subitems exept over the WndProc
btw i list some code of mine:
Code:
///////////////////////
///// ListView Insertitem
///
////////////////////
bool LVaddColumn(PCHAR pszText,HWND ListView,int Index){
LV_COLUMN LvCol;
LvCol.mask=LVCF_FMT | LVCF_WIDTH | LVCF_TEXT | LVCF_SUBITEM; // Type of mask
LvCol.cx=0x0;
LvCol.pszText=pszText; // First Header Text
LvCol.cx=0x1E;
SendMessage(ListView,LVM_INSERTCOLUMN,Index,(LPARAM)&LvCol);
//ListView_InsertColumn(ListView, 0, &LvCol) ;
return(TRUE);
}
void LVaddItem(PUCHAR pszText,HWND ListView,BOOL subitem){
LV_ITEM lvI;
// Initialize LVITEM members that are common to all items.
lvI.mask = LVIF_TEXT|LVIF_PARAM | LVIF_IMAGE | LVIF_STATE|LVCF_SUBITEM;
lvI.state = 0;
if(subitem==1){
lvI.iItem=0;
lvI.iSubItem=1,0;
lvI.pszText=pszText;
SendMessage( // returns LRESULT in lResult
ListView, // (HWND) handle to destination control
LVM_SETITEM, // (UINT) message ID
0, // = 0; not used, must be zero
(LPARAM)(LPLVITEM)&lvI // = const (LPARAM)(LPLVITEM) pitem;
);
} else {
lvI.iItem=0;
lvI.stateMask = LVIS_SELECTED|LVIS_FOCUSED;
lvI.pszText=pszText;
SendMessage( // returns LRESULT in lResult
ListView, // (HWND) handle to destination control
LVM_INSERTITEM, // (UINT) message ID
0, // = 0; not used, must be zero
(LPARAM)(LPLVITEM)&lvI // = const (LPARAM)(LPLVITEM) pitem;
);
}
}
Code:
ListView0=CreateListView(ObjEditorWindow,"ListView",HMENU)ID_LISTVIEW,0,0,400,400);
LVaddItem("b",ListView0,false);
LVaddItem("c",ListView0,false);
LVaddItem("d",ListView0,false);
LVaddItem("a",ListView0,true);
LVaddColumn("03",ListView0,1);
LVaddColumn("04",ListView0,2);
it adds d c b in the ListView collumn namend 03
but nothing into the 04
if use the Winproc WM_Notify routine
like this (at the ObjEditorWindow WndProc)
Code:
case WM_NOTIFY:
{
switch (((LPNMHDR) lParam)->code)
{
case LVN_GETDISPINFO:
NMLVDISPINFO* plvdi = (NMLVDISPINFO*)lParam;
switch (plvdi->item.iItem)
{
case 0:
plvdi->item.pszText ="9";
break;
default:
break;
}
} break;
}
it puts the 9 into the column namend 04
but is there a way without the WndProc