hello MFC
刚学MFC很多问题不明白:
我看了《MFC Windows程序设计》这本书,有个hello MFC的例子,光盘上有,双击就能运行,界面很简单,没有菜单栏,没有工具栏,也没有状态栏,所以我也想自己做一个,因为选择MFC Application后界面复杂了,不想要,就选择了,Visual C++ 的Empty Project,在Solution Explorer面板中加入 Header Files--Hello.h和Source Files--Hello.cpp的文件,内容是:
//hello.h/////////////////////
class CMyApp : public CWinApp
{
public:
virtual BOOL InitInstance ();
};
class CMainWindow : public CFrameWnd
{
public:
CMainWindow ();
protected:
afx_msg void OnPaint ();
DECLARE_MESSAGE_MAP ()
};
//hello.cpp/////////////////////////
#include <afxwin.h>
#include "Hello.h"
CMyApp myApp;
/////////////////////////////////////////////////////////////////////////
// CMyApp member functions
BOOL CMyApp::InitInstance ()
{
m_pMainWnd = new CMainWindow;
m_pMainWnd->ShowWindow (m_nCmdShow);
m_pMainWnd->UpdateWindow ();
return TRUE;
}
/////////////////////////////////////////////////////////////////////////
// CMainWindow message map and member functions
BEGIN_MESSAGE_MAP (CMainWindow, CFrameWnd)
ON_WM_PAINT ()
END_MESSAGE_MAP ()
CMainWindow::CMainWindow ()
{
Create (NULL, _T ("The Hello Application"));
}
void CMainWindow::OnPaint ()
{
CPaintDC dc (this);
CRect rect;
GetClientRect (&rect);
dc.DrawText (_T ("Hello, MFC"), -1, &rect,
DT_SINGLELINE | DT_CENTER | DT_VCENTER);
}
编译时候出错:Error 1 fatal error LNK1561: entry point must be defined
请教各位大侠该怎么办,是不是不能用Empty Project来弄?
如果是这样的,那么怎么在MFC中建立像光盘中只有.cpp .h .dsp .dsw(没有编译之前)四个文件就能使用的程序?
我看了《MFC Windows程序设计》这本书,有个hello MFC的例子,光盘上有,双击就能运行,界面很简单,没有菜单栏,没有工具栏,也没有状态栏,所以我也想自己做一个,因为选择MFC Application后界面复杂了,不想要,就选择了,Visual C++ 的Empty Project,在Solution Explorer面板中加入 Header Files--Hello.h和Source Files--Hello.cpp的文件,内容是:
//hello.h/////////////////////
class CMyApp : public CWinApp
{
public:
virtual BOOL InitInstance ();
};
class CMainWindow : public CFrameWnd
{
public:
CMainWindow ();
protected:
afx_msg void OnPaint ();
DECLARE_MESSAGE_MAP ()
};
//hello.cpp/////////////////////////
#include <afxwin.h>
#include "Hello.h"
CMyApp myApp;
/////////////////////////////////////////////////////////////////////////
// CMyApp member functions
BOOL CMyApp::InitInstance ()
{
m_pMainWnd = new CMainWindow;
m_pMainWnd->ShowWindow (m_nCmdShow);
m_pMainWnd->UpdateWindow ();
return TRUE;
}
/////////////////////////////////////////////////////////////////////////
// CMainWindow message map and member functions
BEGIN_MESSAGE_MAP (CMainWindow, CFrameWnd)
ON_WM_PAINT ()
END_MESSAGE_MAP ()
CMainWindow::CMainWindow ()
{
Create (NULL, _T ("The Hello Application"));
}
void CMainWindow::OnPaint ()
{
CPaintDC dc (this);
CRect rect;
GetClientRect (&rect);
dc.DrawText (_T ("Hello, MFC"), -1, &rect,
DT_SINGLELINE | DT_CENTER | DT_VCENTER);
}
编译时候出错:Error 1 fatal error LNK1561: entry point must be defined
请教各位大侠该怎么办,是不是不能用Empty Project来弄?
如果是这样的,那么怎么在MFC中建立像光盘中只有.cpp .h .dsp .dsw(没有编译之前)四个文件就能使用的程序?
...全文
相关推荐
hello mfc 教程
MFC资源,可以看 一下,我主要就是得积分的
MFC Windows 程序设计[四]之Hello, MFC
MFC是微软公司提供的一个类库(class libraries),用以减少应用程序开发人员的工作量。其中包含大量Windows句柄封装类和很多Windows的内建控件和组件的封装类。有很多初学MFC的小伙伴们都觉得MFC比较难学,看书吧,看了就忘了,网上的一些教程又是写的含糊不清,故而学习起来很吃力...... 故此,本专栏亲自研究,实践,由易到难,层层深入,将调试过程中所遭所遇进行详细讲解,注意事项进行一一列举,希望能够帮助到各位初学MFC的小伙伴,避免走弯路,费时费力。
MFC Windows 程序设计之Hello,MFC
MFC Windows 程序设计的健工程的小程序,适合初学MFC的小伙伴参考学习。
基于MFC的VTK Hello world程序
通过Hello World程序演示MFC与VTK的结合使用! 此“Hello World”程序,演示了基于VTK的应用程序框架搭建的套路!该程序的功能仅是在屏幕上打印字符串“Hello World”!主要步骤如下: 1.基于Visual C++ 6.0的应用程序向导创建“单文档应用程序”。 2.设置project setting 指定VTK库文件所在路径;
Hello_1.rar_hello world MFC_world
此程序为mfc的入门程序 hello world


