你typedef CTypedPtrArray<CObArray, CPrintCell*> PRINT_CELL;
是在哪个文件定义的?
我按你的代码做了,并无错误。
1。用向导生成基于对话框的程序名字为55
2。添加类新类CPrintCell3。在CMy55Dlg的头文件加入
// 55Dlg.h : header file
#include "Afxtempl.h"
#include "PrintCell.h"类中成员变量
class CMy55Dlg : public CDialog
{
// Construction
public:
typedef CTypedPtrArray<CObArray, CPrintCell*> PRINT_CELL;
PRINT_CELL  m_PrintData;

};
在CMy55Dlg 类中添加成员函数Add,返回值为void
CMy55Dlg .h 文件里public:
void Add();CMy55Dlg .cpp 文件里
void CMy55Dlg::Add()
{
CPrintCell *pPrintCell = new CPrintCell;
m_PrintData.Add(pPrintCell);
//位置
m_PrintData[0]->m_nRow = 7;
m_PrintData[0]->m_nCol = 7;
}
加button1
void CMy55Dlg::OnButton1() 
{Add();}