Click to See Complete Forum and Search --> : MFC Tree Control: How to add checkboxes to a tree control?


Gabriel Fleseriu
February 14th, 2003, 09:11 AM
Q: How to add checkboxes to a tree control?

A:


At design time, use the resource editor to enable the "Check boxes" style.
<br>
At run-time, add the 'TVS_CHECKBOXES' style to the tree control, after you have created it and before you have populated it.


DWORD dwLong = m_tree.GetWindowLong(GWL_EXSTYLE);
dwLong |= TVS_CHECKBOXES;
m_tree.SetWindowLong(GWL_EXSTYLE, dwLong);


<br>