大家帮忙看看这个程序是怎么弄出来的

whhiter whhiter 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
本人学vc不久 今天看了一个程序 里面有MFC的消息映射 可是又没有View类MainFrame类 跟MFC AppWizard 长生出来的源代码又不一样 小弟就不知道是怎么办了 哪位达人帮忙看看 谢了

以下是这个程序的源代码,头文件没有贴出来
只有两个类canvasApp 和 canvasFrame

// canvasApp.cpp: implementation of the canvasApp class.
//
//////////////////////////////////////////////////////////////////////

#include "stdafx.h"
#include "canvasr.h"
#include "canvasApp.h"
#include "canvasFrame.h"

#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif

//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
canvasApp canvas;
canvasApp::canvasApp()
{

}

canvasApp::~canvasApp()
{

}
canvasApp::InitInstance()
{
m_pMainWnd = new canvasFrame;
m_pMainWnd->ShowWindow( m_nCmdShow );
m_pMainWnd->UpdateWindow();
return true;
}

// canvasFrame.cpp : implementation file
//

#include "stdafx.h"
#include "canvasr.h"
#include "canvasFrame.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// canvasFrame


IMPLEMENT_DYNCREATE(canvasFrame, CFrameWnd)

canvasFrame::canvasFrame()
{
RECT rect;
Create(NULL,"绘图窗口");
CClientDC dc(this);
int width = dc.GetDeviceCaps(HORZRES);
int height = dc.GetDeviceCaps(VERTRES);
GetWindowRect( &rect );
width = ( width - ( rect.right - rect.left ))/2 ;
height = (height - (rect.bottom - rect.top ))/2 ;
MoveWindow( width , height , (rect.right - rect.left ) , (rect.bottom - rect.top ) ,true);
}

canvasFrame::~canvasFrame()
{
}


BEGIN_MESSAGE_MAP(canvasFrame, CFrameWnd)
//{{AFX_MSG_MAP(canvasFrame)
// NOTE - the ClassWizard will add and remove mapping macros here.
//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// canvasFrame message handlers

...全文
评论 5
收藏 已收藏
分享
返回顶部
whhiter
VC/MFC 16,550 成员 421,606 内容