发在C++版了,这边分数少了,真急用,谢谢大家了,网址
http://community.csdn.net/Expert/topic/5432/5432336.xml?temp=6.821841E-02粘过来的内容:
使用VC,我编了如下两个类,一个CMyTree类,继承自CTreeCtrl类,另一个自定义类CMyData,处理一些数据用
CMyTree//继承CTreeCtrl
{
private:
//FriendInfo是我的一个结构
    CArray <FriendInfo,FriendInfo&> information;
public:
    bool AddFri(...)
    {
        //...不相关代码
        FriendInfo temp;
        information.Add(temp);//出错的地方
}
CMydata  //处理一些数据
{
    private:
        CMyTree m_tree;    UINT CClientData::SetFrient(CString FriendList,CTreeCtrl *tree)
    {
        m_tree = (CMyTree*)tree;
        //...不相关代码
        m_tree.AddFri(...);//调用CMyTree.AddFri(),出错    
    }
}本来我用的是vector,使用push_back的时候出错,因为急用,也没深究,改用了CArray,没想到还是出错,调试了一下,具体出错在如下代码中:void CArray<TYPE, ARG_TYPE>::SetAtGrow(INT_PTR nIndex, ARG_TYPE newElement)
{
ASSERT_VALID(this);//出错的地方
ASSERT(nIndex >= 0);

if(nIndex < 0)
AfxThrowInvalidArgException(); if (nIndex >= m_nSize)
SetSize(nIndex+1, -1);
m_pData[nIndex] = newElement;
}请各位帮帮忙啦,谢谢,急用啊哦,补上FriendInfo结构,FriendState是一个枚举
struct FriendInfo
{
CString nickname;
CString ip;
int image;
CString ID;
FriendState state;
};enum FriendState{ OFFLINE,ONLINE,BUSY,HIDE,NOCHANGE };