Chapter 3: Windows Resources Visual C++ and MFC Fundamentals
Figure 46: Simple Menu................................................................................................................
- To use the new menu, open the Exercise.cpp file and change the
CFrameWnd::Create() method as follows:
#include <afxwin.h>
#include "resource.h"
class CResApp: public CWinApp
{
public:
BOOL InitInstance();
};
class CResFrame : public CFrameWnd
{
public:
CResFrame()
{
Create(NULL, "Resources Fundamentals",
WS_OVERLAPPEDWINDOW, CRect(200, 120, 640, 400),
NULL,
MAKEINTRESOURCE(IDR_MENU_RES));
}
};
BOOL CResApp::InitInstance()
{
m_pMainWnd = new CResFrame;
m_pMainWnd->ShowWindow(SW_SHOW);
m_pMainWnd->UpdateWindow();
return TRUE;
}
CResApp theApp;
- Test the application