Assuming a definition like this,
void CConfigTest::OnSelchangedTree(NMHDR* pNMHDR, LRESULT* pResult)
{
NM_TREEVIEW* pNMTreeView = (NM_TREEVIEW*)pNMHDR;
TVITEM item = pNMTreeView->itemNew;
// find the session of the selected item
if(item.hItem != NULL)
{
HTREEITEM root, parent, node;
node = item.hItem;
parent = m_treeSM.GetParentItem(item.hItem);
root = m_treeSM.GetRootItem();
while(parent != root && parent != NULL)
{
node = parent;
parent = m_treeSM.GetParentItem(parent);
}
MyCommand* pCmd = (MyCommand*)(m_treeSM.GetItemData(node));
....
....
I tried these statements below, but failed.
pCmd->subList[2]
(pCmd->subList)[2]
How can I get the array member values(such as subList[2]). I want to replace the value of subList[2] with other same type value. Thank you.
Lists do not support random access. You need to switch to another container type which does, or iterate over the list until you reach the element you want.