#include
"afxwin.h"
#include
"resource.h"
classMyFrame:publicCFrameWnd
{
public:MyFrame()
{
//Create
Menu using Create function
//Create(NULL,"SimpleWindow",WS_OVERLAPPEDWINDOW,rectDefault,0,MAKEINTRESOURCE(IDR_MENU1));
//Create
Menu Using LoadMenu
Create(NULL,"Simple Window");
}
//Craete
Menu using load menu
intOnCreate(LPCREATESTRUCT l)
{
CMenu m;
m.LoadMenu(IDR_MENU1);
SetMenu(&m);
return 1;
}
void open()
{
MessageBox("Open is clicked");
}
DECLARE_MESSAGE_MAP()
};
BEGIN_MESSAGE_MAP(MyFrame,CFrameWnd)
ON_WM_CREATE()
ON_COMMAND(101,open)
END_MESSAGE_MAP()
classMyMain:publicCWinApp
{
public:intInitInstance()
{
MyFrame *f=new MyFrame();
f->ShowWindow(1);
m_pMainWnd=f;
return 1;
}
};
MyMain m;
No comments:
Write comments