【发布时间】:2011-05-01 14:56:09
【问题描述】:
我想以编程方式设置要选择的树 ctrl 项的状态,然后在其他地方处理它。我想这样做以重用用户单击它时调用的代码。我尝试了这个,但它失败了,为什么?
// somewhere in the code
m_tree.SetItemState(hItemToBeSelected, TVIS_SELECTED, TVIS_SELECTED);
CommonFunction();
// elsewhere
CommonFunction()
{
HTREEITEM h = m_tree.GetSelectedItem();// this returns NULL.
}
我该怎么做?
【问题讨论】: