Export (0) Print
Expand All
Expand Minimize
1 out of 1 rated this helpful - Rate this topic


Determines if the state image of a list control item is visible.

BOOL SetCheck(
   int nItem,
   BOOL fCheck = TRUE 



The zero-based index of a list control item.


Specifies whether the state image of the item should be visible or not. By default, fCheck is TRUE and the state image is visible. If fCheck is FALSE, it is not visible.

Nonzero if the item is checked, otherwise 0.

// The pointer to my list view control.
extern CListCtrl* pmyListCtrl;

int nCount = pmyListCtrl->GetItemCount();
BOOL fCheck = FALSE;

// Set the check state of every other item to TRUE and 
// all others to FALSE.
for (int i=0;i < nCount;i++)
   pmyListCtrl->SetCheck(i, fCheck);
   ASSERT((pmyListCtrl->GetCheck(i) && fCheck) || 
      (!pmyListCtrl->GetCheck(i) && !fCheck));
   fCheck = !fCheck;
Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

© 2014 Microsoft. All rights reserved.