0% found this document useful (0 votes)
9 views2 pages

1 спс

This document defines a CMyFrameWnd class that inherits from the CFrameWnd class. It includes header files needed for MFC applications and defines message map entries for menu commands like File, Edit, Help. Methods like OnAbout, OnEdit are defined to show message boxes. A CMyApp class is also defined that inherits from CWinApp and overrides the InitInstance method to create an instance of CMyFrameWnd and set it as the main window.

Uploaded by

ranaabstract
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views2 pages

1 спс

This document defines a CMyFrameWnd class that inherits from the CFrameWnd class. It includes header files needed for MFC applications and defines message map entries for menu commands like File, Edit, Help. Methods like OnAbout, OnEdit are defined to show message boxes. A CMyApp class is also defined that inherits from CWinApp and overrides the InitInstance method to create an instance of CMyFrameWnd and set it as the main window.

Uploaded by

ranaabstract
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 2

#include <afxext.

h>
#include <windows.h>
#include <afxwin.h>
#include "resource.h"

class CMyFrameWnd:public CFrameWnd


{
public :
CMyFrameWnd();
afx_msg void OnAbout();
afx_msg void OnEdit();
afx_msg void OnInput();
afx_msg void OnOpen();
afx_msg void OnSave();
afx_msg void OnQuit();
afx_msg void OnRun();
afx_msg void OnRestart();
afx_msg void OnResult();
afx_msg void OnHelp();
DECLARE_MESSAGE_MAP();
};
BEGIN_MESSAGE_MAP(CMyFrameWnd, CFrameWnd)
ON_COMMAND(ID_ABOUT,OnAbout)
ON_COMMAND(ID_EDIT,OnEdit)
ON_COMMAND(ID_INPUT,OnInput)
ON_COMMAND(ID_FILE_OPEN40001,OnOpen)
ON_COMMAND(ID_FILE_SAVE40002,OnSave)
ON_COMMAND(ID_FILE_QUIT,OnQuit)
ON_COMMAND(ID_CALC_RUN,OnRun)
ON_COMMAND(ID_CALC_RESTART,OnRestart)
ON_COMMAND(ID_CALC_RESULT,OnResult)
ON_COMMAND(ID_HELP40010,OnHelp)
END_MESSAGE_MAP();
CMyFrameWnd::CMyFrameWnd()
{
Create(NULL,"My first program",
WS_OVERLAPPEDWINDOW, rectDefault,NULL,MAKEINTRESOURCE(IDR_MENU1));
};
void CMyFrameWnd::OnAbout(){
::MessageBox(NULL,"Copyright by Semerenko","About",MB_OK|
MB_ICONEXCLAMATION);
}
void CMyFrameWnd::OnEdit(){
::MessageBox(NULL,"Copyright by Semerenko Edit","Edit",MB_OK|
MB_ICONEXCLAMATION);
}
void CMyFrameWnd::OnInput(){
::MessageBox(NULL,"Copyright by Semerenko Input","Input",MB_OK|
MB_ICONEXCLAMATION);
}
void CMyFrameWnd::OnOpen(){
::MessageBox(NULL,"Copyright by Semerenko","Open",MB_OK|
MB_ICONEXCLAMATION);
}
void CMyFrameWnd::OnSave(){
::MessageBox(NULL,"Copyright by Semerenko","Save",MB_OK|
MB_ICONEXCLAMATION);
}
void CMyFrameWnd::OnQuit(){
::MessageBox(NULL,"Copyright by Semerenko","Quit",MB_OK|
MB_ICONEXCLAMATION);
}
void CMyFrameWnd::OnRun(){
::MessageBox(NULL,"Copyright by Semerenko","Run",MB_OK|
MB_ICONEXCLAMATION);
}
void CMyFrameWnd::OnRestart(){
::MessageBox(NULL,"Copyright by Semerenko","Restart",MB_OK|
MB_ICONEXCLAMATION);
}
void CMyFrameWnd::OnResult(){
::MessageBox(NULL,"Copyright by Semerenko","Result",MB_OK|
MB_ICONEXCLAMATION);
}
void CMyFrameWnd::OnHelp(){
::MessageBox(NULL,"Copyright by Semerenko","Help",MB_OK|
MB_ICONEXCLAMATION);
}
class CMyApp:public CWinApp
{
public:
virtual BOOL InitInstance();
};
BOOL CMyApp::InitInstance()
{
CMyFrameWnd *pMainWnd=new CMyFrameWnd;
m_pMainWnd=pMainWnd;
m_pMainWnd->ShowWindow(m_nCmdShow);
m_pMainWnd->UpdateWindow();
return TRUE;
};
CMyApp app;

You might also like