ColoradoWolf
November 1st, 2000, 05:00 PM
I am running into a problem trying to insert
items in a derived CTreeView class. The code for
my insertion function is as follows:
bool CPIMTreeCtrl::InsertNormalItem(HTREEITEM hParent,
int imgIdx,
CPIMTreeItem* pItem)
{
HTREEITEM hItem = InsertItem(LPSTR_TEXTCALLBACK,imgIdx,imgIdx,
hParent,TVI_SORT);
if (hItem&&pItem->AddHandle(hItem)) {
EnsureVisible(hItem);
SelectItem(hItem);
return(true);
}
else {
return(false);
}
}
The first item I insert using the above function
has no problems. The second node I insert using
this fn (with same hParent) flags an access
violation in USER32.dll (from a call within
COMCTL32.dll) on the CTreeCtrl::InsertItem()
call. I am using VC++ 6 SP4 (MFC4.2) on Win2K.
Has anyone else seen this? Does the parent get
modified and need to be stored again after
inserting a child? Is this just a VC++ bug? Any
info would be appreciated. Thanks.
CW
items in a derived CTreeView class. The code for
my insertion function is as follows:
bool CPIMTreeCtrl::InsertNormalItem(HTREEITEM hParent,
int imgIdx,
CPIMTreeItem* pItem)
{
HTREEITEM hItem = InsertItem(LPSTR_TEXTCALLBACK,imgIdx,imgIdx,
hParent,TVI_SORT);
if (hItem&&pItem->AddHandle(hItem)) {
EnsureVisible(hItem);
SelectItem(hItem);
return(true);
}
else {
return(false);
}
}
The first item I insert using the above function
has no problems. The second node I insert using
this fn (with same hParent) flags an access
violation in USER32.dll (from a call within
COMCTL32.dll) on the CTreeCtrl::InsertItem()
call. I am using VC++ 6 SP4 (MFC4.2) on Win2K.
Has anyone else seen this? Does the parent get
modified and need to be stored again after
inserting a child? Is this just a VC++ bug? Any
info would be appreciated. Thanks.
CW