First I add TVS_EX_PARTIALCHECKBOXES to the extended CTreeCtrl styles:
TreeView_SetExtendedStyle(tree->GetSafeHwnd(), TVS_EX_PARTIALCHECKBOXES, TVS_EX_PARTIALCHECKBOXES);
Now, how can I set any item to this state? Apparently, the documentation does not exist. I guessed that by checking and unmarking the work, changing the image of the state of the element to 1 or 2, I can try my luck with 3:
tree->SetItemState(tree->GetFirstVisibleItem(), INDEXTOSTATEIMAGEMASK(3), TVIS_STATEIMAGEMASK);
Of course, that would be too simple, the image just disappeared.
source
share