Question : checkbox and listctrl

In a CListCtrl object putted in a dialog, I want to insert an checkbox before every first column, and then get the rows if the checkbox in that row is ckecked. How?

Answer : checkbox and listctrl

Did you try :
m_YourListCtrl.SetExtendedStyle(m_YourListCtrl.GetExtendedStyle() | LVS_EX_CHECKBOXES);

(in your initDlg for instance).

Then in order to find whether an item is checked or not :

for(int i=0;iemCount();i++)
{
     if(m_YourListCtrl.GetCheck(i))
     {
         //Add you code that handles checked items
     }
}

Well let me check if the second part of my answer will work (not sure GetChecked will work as I want, perhaps we 'll have to use GetItemState ...).
 
Random Solutions  
 
programming4us programming4us