VS2005的问题
我用的是VS2005但是我学习的书是VS2003的,所以在照书上的方法编程时出现了一些问题,求大虾帮帮忙看看要如何修改。// DialogDemoView.cpp : CDialogDemoView 类的实现
//
#include "stdafx.h"
#include "DialogDemo.h"
#include "DialogDemoDoc.h"
#include "DialogDemoView.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#endif
// CDialogDemoView
IMPLEMENT_DYNCREATE(CDialogDemoView, CView)
BEGIN_MESSAGE_MAP(CDialogDemoView, CView)
// 标准打印命令
ON_COMMAND(ID_FILE_PRINT, &CView::OnFilePrint)
ON_COMMAND(ID_FILE_PRINT_DIRECT, &CView::OnFilePrint)
ON_COMMAND(ID_FILE_PRINT_PREVIEW, &CView::OnFilePrintPreview)
ON_COMMAND(ID_ShowDialog, &CDialogDemoView::OnShowdialog)
END_MESSAGE_MAP()
// CDialogDemoView 构造/析构
CDialogDemoView::CDialogDemoView()
{
// TODO: 在此处添加构造代码
}
CDialogDemoView::~CDialogDemoView()
{
}
BOOL CDialogDemoView::PreCreateWindow(CREATESTRUCT& cs)
{
// TODO: 在此处通过修改
// CREATESTRUCT cs 来修改窗口类或样式
return CView::PreCreateWindow(cs);
}
// CDialogDemoView 绘制
void CDialogDemoView::OnDraw(CDC* /*pDC*/)
{
CDialogDemoDoc* pDoc = GetDocument();
ASSERT_VALID(pDoc);
if (!pDoc)
return;
// TODO: 在此处为本机数据添加绘制代码
}
// CDialogDemoView 打印
BOOL CDialogDemoView::OnPreparePrinting(CPrintInfo* pInfo)
{
// 默认准备
return DoPreparePrinting(pInfo);
}
void CDialogDemoView::OnBeginPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
{
// TODO: 添加额外的打印前进行的初始化过程
}
void CDialogDemoView::OnEndPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
{
// TODO: 添加打印后进行的清除过程
}
// CDialogDemoView 诊断
#ifdef _DEBUG
void CDialogDemoView::AssertValid() const
{
CView::AssertValid();
}
void CDialogDemoView::Dump(CDumpContext& dc) const
{
CView::Dump(dc);
}
CDialogDemoDoc* CDialogDemoView::GetDocument() const // 非调试版本是内联的
{
ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CDialogDemoDoc)));
return (CDialogDemoDoc*)m_pDocument;
}
#endif //_DEBUG
// CDialogDemoView 消息处理程序
void CDialogDemoView::OnShowdialog()
{
// TODO: 在此添加命令处理程序代码
MyDialog mydialog;
mydialog.DoModal();
}错误的提示如下
正在编译...
1>DialogDemoView.cpp
1>c:\documents and settings\tk2479\my documents\试验作品\dialogdemo\dialogdemo\dialogdemoview.cpp(105) : error C2065: 'MyDialog' : undeclared identifier
1>c:\documents and settings\tk2479\my documents\试验作品\dialogdemo\dialogdemo\dialogdemoview.cpp(105) : error C2146: syntax error : missing ';' before identifier 'mydialog'
1>c:\documents and settings\tk2479\my documents\试验作品\dialogdemo\dialogdemo\dialogdemoview.cpp(105) : error C2065: 'mydialog' : undeclared identifier
1>c:\documents and settings\tk2479\my documents\试验作品\dialogdemo\dialogdemo\dialogdemoview.cpp(106) : error C2228: left of '.DoModal' must have class/struct/union
1> type is ''unknown-type''
[[it] 本帖最后由 tk2479 于 2008-10-28 16:27 编辑 [/it]]