If you leave the old characters as it is,the edit cotrol will send a NULL string to the tree control,so you must overide the CTreeCtrl::OnEndlabeledit(...)just lik this:

void CMyTreeCtrl::OnEndlabeledit(NUMHDR *pNMHDR,LRESULT *pResult)
{
TV_DISPINFO *pTVDispInfo=(TV_DISPINFO*)pNMHDR;
CString strItem=pTVDispInfo->item.pszText;
if(!strItem.IsEmpth())//if the string is //empty,do nothing!
{
SetItemText(pTVDispInfo- >item.hItem,strItem);
}
}