选择Win32Application 建立项目输入项目名 选择An empty project
选择C++Source 输入下面代码 输入之后单击project菜单的Setting选择Usw MFC in a Shared DLL
#include<afxwin.h>
#include"resource.h"
class CSimplest:public CWinApp
{
public:
virtual BOOL InitInstance();
};
CSimplest Simplest;
class CMyWnd:public CFrameWnd
{
CStatic *cs;
CMenu * menu;
public:
CMyWnd()
{
Create(NULL,"简单MFC程序");
cs=new CStatic();
cs->Create("你好请多指教",
WS_CHILD|WS_VISIBLE|SS_CENTER,CRect(10,10,200,80),
this);
menu=new CMenu();
menu->LoadMenu(IDR_MENU1);
SetMenu(menu);
DrawMenuBar();
}
};
BOOL CSimplest::InitInstance()
{
m_pMainWnd=new CMyWnd();
m_pMainWnd->ShowWindow(m_nCmdShow);
m_pMainWnd->UpdateWindow();
return TRUE;
}
fatal error C1083: Cannot open include file: 'resource.h': No such file or directory
Error executing cl.exe.
Simple.obj - 1 error(s), 0 warning(s)