Results 1 to 2 of 2

Thread: simple MFC app

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    May 2001
    Posts
    837

    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
    The human brain cannot hold all of the knowledge that exists in this world, but it can hold pointers to that knowledge.

  2. #2
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594
    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;
    }
    All the buzzt
    CornedBee

    "Writing specifications is like writing a novel. Writing code is like writing poetry."
    - Anonymous, published by Raymond Chen

    Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width