-
simple MFC app
could someone post the most basic barebones MFC app possible? i don't have any books that explain MFC and i don't wanna buy any. Besides i already understand a little bit of MFC and i understand C++ syntax, im just not sure where to begin a program with MFC
thanks
-
This is the most basic MFC app that I can somehow think of.
It just creates a window, it doesn't even draw it.
Code:
#include <afxwin.h>
class CMainFrame : public CWnd
{
public:
CMainFrame();
};
CMainFrame::CMainFrame()
{
LPCTSTR szClass = AfxRegisterWndClass(0);
CreateEx(0, szClass, "Basic MFC app", WS_OVERLAPPEDWINDOW,
CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, NULL, NULL);
}
class CBasicMFCApp : public CWinApp
{
public:
virtual BOOL InitInstance();
};
CBasicMFCApp theApp;
BOOL CBasicMFCApp::InitInstance()
{
CWnd* pFrame = new CMainFrame;
m_pMainWnd = pFrame;
pFrame->ShowWindow(SW_SHOW);
pFrame->UpdateWindow();
return TRUE;
}