B
Also hier die Antwort:
// function to add a user to a room (treeview)
void AddUserToRoom(char *szRoom, char *szUser)
{
// private
HTREEITEM tiRoot;
TV_ITEM tviTemp;
TCHAR szBuf[LUNATIC_ROOMNAMELEN+1];
// get root item
tiRoot = TreeView_GetRoot(hTreeWnd);
// search criteria
tviTemp.mask = TVIF_TEXT;
tviTemp.hItem = tiRoot;
tviTemp.pszText = szBuf;
tviTemp.cchTextMax = sizeof(szBuf);
// get first item
TreeView_GetItem(hTreeWnd, &tviTemp);
// search next items
while(strcmp(tviTemp.pszText, szRoom)!=0){
tiRoot = TreeView_GetNextSibling(hTreeWnd, tiRoot);
// search criteria
tviTemp.mask = TVIF_TEXT;
tviTemp.hItem = tiRoot;
tviTemp.pszText = szBuf;
tviTemp.cchTextMax = sizeof(szBuf);
// get first item
TreeView_GetItem(hTreeWnd, &tviTemp);
}
// result
AddToTree(szUser, tiRoot, 0);
}