//插入通知 bool __cdecl CUserCompanionList::OnCompanionInsert(tagCompanionItem * pCompanionInfo) { //获取树项 ASSERT(pCompanionInfo!=NULL); HTREEITEM hTreeItem=SearchCompanionInfo(NULL,pCompanionInfo); //事件处理 if (hTreeItem==NULL) InsertCompanionInfo(pCompanionInfo); else UpdateCompanionInfo(hTreeItem,pCompanionInfo); return true; }
//更新通知 bool __cdecl CUserCompanionList::OnCompanionUpdate(tagCompanionItem * pCompanionInfo) { //获取树项 ASSERT(pCompanionInfo!=NULL); HTREEITEM hTreeItem=SearchCompanionInfo(NULL,pCompanionInfo); //事件处理 if (hTreeItem==NULL) InsertCompanionInfo(pCompanionInfo); else { tagCompanionItem * pCurrCompanion=(tagCompanionItem *)GetItemData(hTreeItem); UpdateCompanionInfo(hTreeItem,pCompanionInfo); } //更新界面 Invalidate(FALSE); UpdateWindow(); return true; }