I am not able to find (in MSDN), if parameter int cchTextMax of TVITEM structure is included the end null terminated string character \0 or no.
TVITEM structure is used by CTreeCtrl or CTreeView class.
I mean, is it right
cchTextMax = wcslen(lsTxt)
or
cchTextMax = wcslen(lsTxt)+1
??
Thanks for advice.
Unfortunately, the TreeView documentation does not say explicitly whether or not
cchTextMaxincludes the null terminator (on the other hand, the ListView documentation does say, and ListView and TreeView are implemented in the same library, so it is likely that they behave similarly).Since
pszTextpoints to a null-terminated string, andcchTextMaxis the size of thepszTextbuffer in characters, it stands to reason thatcchTextMaxincludes the null terminator. Particularly when retrieving text, sinceTVM_GETITEMand similar messages need to know how large the buffer is so they can store the null terminator and truncate text if needed.