65,210
社区成员
发帖
与我相关
我的任务
分享
#include <afxwin.h>
#include"resource.h"
#define ID_Exit1 11000
class MyFrame:public CFrameWnd
{
.
.
.
#include <afxwin.h>
#include"resource.h"
class MyFrame:public CFrameWnd
{
private:
CMenu*FMenu;
public:
MyFrame()
{
Create(NULL,"Hello MFC");
FMenu=new CMenu;
FMenu->LoadMenu(IDR_MENU1);
SetMenu(FMenu);
}
~MyFrame(){delete FMenu;}
afx_msg void OnExit()
{
MessageBox("Exit1");
DestroyWindow();
}
DECLARE_MESSAGE_MAP()
};
BEGIN_MESSAGE_MAP(MyFrame,CFrameWnd)
ON_COMMAND(IDM_Exit1,OnExit)//这里改成这样
END_MESSAGE_MAP()
class MyApp:public CWinApp
{
public:
BOOL InitInstance()
{
CFrameWnd *Frame = new MyFrame;
m_pMainWnd = Frame;
Frame->ShowWindow(SW_SHOW);
return true;
}
};
MyApp a_app;