我照着“深入浅出MFC”的例子,写出的程序总是不能用,提示如下:(附scribbleDoc.cpp)
错误:
Compiling...
scribbleDoc.cpp
H:\有用资源\vcsoft\scribble\scribbleDoc.cpp(96) : error C2039: 'IsEmpty' : is not a member of 'CTypedPtrList<class CObject,class CStroke *>'
H:\有用资源\vcsoft\scribble\scribbleDoc.cpp(96) : fatal error C1903: unable to recover from previous error(s); stopping compilation
scribbleView.cpp
H:\有用资源\vcsoft\scribble\scribbleView.cpp(64) : error C2440: 'initializing' : cannot convert from 'class CTypedPtrList<class CObject,class CStroke *>' to 'class CTypedPtrList<class CObList,class CStroke *>'
        No constructor could take the source type, or constructor overload resolution was ambiguous
Generating Code...
Error executing cl.exe.scribble.exe - 3 error(s), 0 warning(s)代码:
#include "stdafx.h"
#include "scribble.h"#include "scribbleDoc.h"#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif/////////////////////////////////////////////////////////////////////////////
// CScribbleDocIMPLEMENT_DYNCREATE(CScribbleDoc, CDocument)BEGIN_MESSAGE_MAP(CScribbleDoc, CDocument)
//{{AFX_MSG_MAP(CScribbleDoc)
// NOTE - the ClassWizard will add and remove mapping macros here.
//    DO NOT EDIT what you see in these blocks of generated code!
//}}AFX_MSG_MAP
END_MESSAGE_MAP()/////////////////////////////////////////////////////////////////////////////
// CScribbleDoc construction/destructionCScribbleDoc::CScribbleDoc()
{
// TODO: add one-time construction code here}CScribbleDoc::~CScribbleDoc()
{
}BOOL CScribbleDoc::OnNewDocument()
{
if (!CDocument::OnNewDocument())
return FALSE;
InitDocument();
// TODO: add reinitialization code here
// (SDI documents will reuse this document) return TRUE;
}/////////////////////////////////////////////////////////////////////////////
// CScribbleDoc serializationvoid CScribbleDoc::Serialize(CArchive& ar)
{
if (ar.IsStoring())
{
// TODO: add storing code here
}
else
{
// TODO: add loading code here
}
m_strokeList.Serialize(ar);
}/////////////////////////////////////////////////////////////////////////////
// CScribbleDoc diagnostics#ifdef _DEBUG
void CScribbleDoc::AssertValid() const
{
CDocument::AssertValid();
}void CScribbleDoc::Dump(CDumpContext& dc) const
{
CDocument::Dump(dc);
}
#endif //_DEBUG/////////////////////////////////////////////////////////////////////////////
// CScribbleDoc commands
BOOL CScribbleDoc::OnOpenDocument(LPCTSTR lpszPathName) 
{
if (!CDocument::OnOpenDocument(lpszPathName))
return FALSE;
InitDocument(); 
return TRUE;
}void CScribbleDoc::DeleteContents() 
{
while (!m_strokeList.IsEmpty())
{
delete m_strokeList.RemoveHead();
}
CDocument::DeleteContents();
}void CScribbleDoc::InitDocument()
{
m_nPenWidth = 2; // default 2 pixel pen width
// solid, black pen
m_penCur.CreatePen(PS_SOLID, m_nPenWidth, RGB(0,0,0));
}CStroke* CScribbleDoc::NewStroke()
{
CStroke* pStrokeItem = new CStroke(m_nPenWidth);
m_strokeList.AddTail(pStrokeItem);
SetModifiedFlag();  // Mark the document as having been modified, for
// purposes of confirming File Close.
return pStrokeItem;
}
/////////////////////////////////////////////////////////////////////////////
// CStrokeIMPLEMENT_SERIAL(CStroke, CObject, 1)
CStroke::CStroke()
{
// This empty constructor should be used by serialization only
}CStroke::CStroke(UINT nPenWidth)
{
m_nPenWidth = nPenWidth;
}void CStroke::Serialize(CArchive& ar)
{
if (ar.IsStoring())
{
ar << (WORD)m_nPenWidth;
m_pointArray.Serialize(ar);
}
else
{
WORD w;
ar >> w;
m_nPenWidth = w;
m_pointArray.Serialize(ar);
}
}BOOL CStroke::DrawStroke(CDC* pDC)
{
CPen penStroke;
if (!penStroke.CreatePen(PS_SOLID, m_nPenWidth, RGB(0,0,0)))
return FALSE;
CPen* pOldPen = pDC->SelectObject(&penStroke);
pDC->MoveTo(m_pointArray[0]);
for (int i=1; i < m_pointArray.GetSize(); i++)
{
pDC->LineTo(m_pointArray[i]);
} pDC->SelectObject(pOldPen);
return TRUE;
}