You have the handle to the tree window I will call it hWnd in the code
To add the check boxes
DWORD dwStyle = GetWindowLong(hWnd , GWL_STYLE);
dwStyle |= TVS_CHECKBOXES;
SetWindowLongPtr(hWnd , GWL_STYLE, dwStyle );
To remove them
DWORD dwStyle = GetWindowLong(hWnd , GWL_STYLE);
dwStyle &= (~TVS_CHECKBOXES);
SetWindowLongPtr(hWnd , GWL_STYLE, dwStyle );
DONT FORGET => Invalidate or Redraw the window (hWnd) after it to update the visual on screen