About MFC...
I start off with a win32 application project, turn on using MFC as a statically linked library and then I create the basic skeletal code in a C++ source file.
After that I add it to the project and then make a menu resource.
I save that menu resource in the project directory and add it to the project.
This is the source file:
#include <afxwin.h>
class CMainWin: public CFrameWnd
{
public:
CMainWin();
DECLARE_MESSAGE_MAP()
private:
};
CMainWin::CMainWin()
{
Create(NULL, "My Application", WS_OVERLAPPEDWINDOW, rectDefault, NULL, "IDR_MENU1");
}
class CApp: public CWinApp
{
public:
BOOL InitInstance();
};
BOOL CApp::InitInstance()
{
m_pMainWnd = new CMainWin;
m_pMainWnd->ShowWindow(m_nCmdShow);
m_pMainWnd->UpdateWindow();
return true;
}
BEGIN_MESSAGE_MAP(CMainWin, CFrameWnd)
END_MESSAGE_MAP()
CApp App;
However, I always get a run time error as soon as the program starts.
Could someone please explain what I''m doing wrong?
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement