初学MFC问题

[复制链接]
查看11 | 回复1 | 2009-3-10 11:30:30 | 显示全部楼层 |阅读模式
//MFCWindow.h
//应用程序类
class CMFCApp : public CWinApp{
public :
virtual BOOL InitInstance();
};
//主窗口类
class CMFCWindow : public CFrameWnd{
public:
CMFCWindow();
protected:
afx_msg void OnPaint();
DECLARE_MESSAGE_MAP();
};
MFCWindow.cpp
#include
#include "MFCWindow.h"
//声明应用程序类实例
CMFCApp mfcApp;
BOOL CMFCApp::InitInstance(){
m_pMainWnd=new CMFCWindow();
m_pMainWnd->ShowWindow(m_nCmdShow);
m_pMainWnd->UpdateWindow();
return TRUE;
}
//建立消息映射
BEGIN_MESSAGE_MAP(CMFCWindow,CFrame Wnd)
ON_WM_PAINT()
END_MESSAGE_MAP()
//窗口类的构造函数
CMFCWindow::CMFCWindow(){
Create(NULL,_T(" my First~"));
}
//对WM_PAINT消息进行响应
void CMFCWindow::OnPaint(){
CPaintDC dc(this);
CRect rect;
GetClientRect(&rect);
//屏幕中央显示文字
dc.DrawText(_T("欢迎使用"),-1,&rect,DT_SINGLELINE | DT_CENTER |DT_VCENTER);
}
编译不能通过为什么,请指点下,谢谢~
1>MFCWindow.cpp
1> WINVER not defined. Defaulting to 0x0502 (Windows Server 2003)
1>g:\sang\sang_practice\my_c++\vc++2005\第七章\mfcwindow\mfcwindow\mfcwindow.cpp(13) : error C2146: syntax error : missing ';' before identifier 'Wnd'
1>g:\sang\sang_practice\my_c++\vc++2005\第七章\mfcwindow\mfcwindow\mfcwindow.cpp(13) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>g:\sang\sang_practice\my_c++\vc++2005\第七章\mfcwindow\mfcwindow\mfcwindow.cpp(13) : error C2065: 'Wnd' : undeclared identifier
1>g:\sang\sang_practice\my_c++\vc++2005\第七章\mfcwindow\mfcwindow\mfcwindow.cpp(13) : error C2146: syntax error : missing ';' before identifier 'TheBaseClass'
1>g:\sang\sang_practice\my_c++\vc++2005\第七章\mfcwindow\mfcwindow\mfcwindow.cpp(13) : error C2065: 'TheBaseClass' : undeclared identifier
1>生成日志保存在“file://g:\Sang\Sang_Practice\My_C++\VC++2005\第七章\MFCWindow\MFCWindow\Debug\BuildLog.htm”

回复

使用道具 举报

千问 | 2009-3-10 11:30:30 | 显示全部楼层
把出错信息贴出来看一下--------------------------------------------//建立消息映射 BEGIN_MESSAGE_MAP(CMFCWindow,CFrame Wnd)<-错误在这里,CFrame 和Wnd之间多了个空格...
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

主题

0

回帖

4882万

积分

论坛元老

Rank: 8Rank: 8

积分
48824836
热门排行