Hello, I'm trying to get the 32-bit value associated with an item of a treeview control, but I'm not able to find the way of do it; I'm able to get the pszText associated to an item, so the item pointer (HTREEITEM) is right. I have been reading on the Win32 Prog Reference and find the next explanation referred to the struct TV_ITEM used in the TVM_GETITEM message:
Code:
Pointer to a TV_ITEM structure that specifies the information to retrieve and receives information about
the item. When the message is sent, the hItem member identifies the item to retrieve information about
and the mask member specifies the attributes to retrieve.
If mask specifies the TVIF_TEXT value, the pszText member must contain the pointer to the buffer that
receives the item text and the cchTextMax member must specify the size of the buffer.
If mask specifies the TVIF_STATE value, the stateMask member indicates which item states are to be returned.
So can I only get the text and the state?
That's what I do to get the item:
Code:
char gbff[300];
DWORD dwValue;
HTREEITEM htree;
htree=(HTREEITEM)SendMessage(theTreeViewControlHandle,TVM_GETNEXTITEM,(WPARAM)TVGN_ROOT,(LPARAM)htree);
memset(&tvi,0,sizeof(tvi));
tvi.mask=TVIF_PARAM|TVIF_TEXT;
tvi.pszText=gbff;
tvi.cchTextMax=300;
tvi.lParam=dwValue;
tvi.hItem=htree;
SendMessage(GetDlgItem(hwnd,ARBRE),TVM_GETITEM,0,(LPARAM)&tvi);
MessageBox(hwnd,gbff,"",MB_OK);
sprintf(gbff,"%d, %d",LOWORD(dwValue),HIWORD(dwValue));
MessageBox(hwnd,gbff,"",MB_OK);
From that code I get the item text in the first alert, but "0, 0" on the second alert. I'm afraid that as the W32 Prog Ref says, the only 'getable' values are the text and the state. I'm doing it right, or there's a different way than TVM_GETITEM to get the lParam associated to an item?
Thank's in advance.
Niara