project 页面中选择Win32Application 之后选择An empty project 在C++中输入下面的程序,
在Project菜单中的Setting选择Use 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.
Smpl.exe - 1 error(s), 0 warning(s)