Read the documentation, it tells you what you need to know:
lParam
Pointer to anNMTVDISPINFO
structure. Theitem
member of this structure is aTVITEM
structure whosehItem
,lParam
, andpszText
members contain valid information about the item that was edited. If label editing was canceled, thepszText
member of theTVITEM
structure is NULL; otherwise,pszText
is the address of the edited text.Return value
If the
pszText
member is non-NULL, return TRUE to set the item's label to the edited text. Return FALSE to reject the edited text and revert to the original label.Remarks
If the
pszText
member is NULL, the return value is ignored.If you specified the
LPSTR_TEXTCALLBACK
value for this item and thepszText
member is non-NULL, yourTVN_ENDLABELEDIT
handler should copy the text frompszText
to your local storage.
So, try something like this:
...
if (((LPNMHDR)lParam)->code == TVN_BEGINLABELEDIT)
{
hEdit = TreeView_GetEditControl(hTree);
SetFocus(hEdit);
break;
}
if (((LPNMHDR)lParam)->code == TVN_ENDLABELEDIT)
{
if ((LPNMTVDISPINFO)lParam)->item.pszText != NULL)
return TRUE; // or FALSE to reject the next text...
break;
}
...