How to let the CListCtrl selected
-
There are many object in the same windows,How to let the CListCtrl selected by program othe than by tne mouse?
-
i is the item number in the list you want to select SetItemState(i, LVIS_SELECTED|LVIS_FOCUSED, LVIS_SELECTED|LVIS_FOCUSED);
-
There are many object in the same windows,How to let the CListCtrl selected by program othe than by tne mouse?
If you have a pointer to the CListCtrl object, you can simply use CWnd::SetFocus[^] this way:
m_pListCtrl.SetFocus();
If you don't have a pointer to the CListCtrl, you can use CWnd::GetDlgItem [^] on the parent window to obtain one.
CTheControlParent::SetFocusOnListCtrl()
{
CWnd* pWnd = GetDlgItem(THE_ID_OF_THE_LIST_CTRL);
if (pWnd != NULL)
pWnd->SetFocus()
}Hope that helps, -- jlr http://jlamas.blogspot.com/[^]