Creating a Mini Frame-Based Application



This topic shows how to create a mini frame, as opposed to a full main frame, based application


A mini frame is frame window with tool window type of title based. Although it is usually used as an addition to a full frame window, you can still create an application whose main or primary object is a mini frame.

Creating the Application

The mini frame window is based on the CMiniFrameWnd class. If you want to create an application based on it, don't use the application wizard. For one thing the job involved in modifying the application can be overwhelming and uselessly difficult. For another, it is particularly easy to create a mini frame-based application. What you have to do is to call and retrieve the return value of the AfxRegisterWndClass() global function, declare a variable or a pointer to CMiniFrameWnd, pass it to the CMiniFrameWnd::Create() method, and finally initialize the application's m_pMainWnd variable.

Practical Learning: Starting the Exercise

  1. Start Microsoft Visual C++ and create a Win32 Application or Project named ExoMini1
  2. Create it as an Empty Project
  3. Access the project settings or properties settings and choose to Use MFC In A Shared DLL
  4. Add a new C++ Source File and name it Exercise
  5. In the empty file, type the following:
    #include <afxwin.h>
    class CExerciseApp : public CWinApp
    	BOOL InitInstance();
    BOOL CExerciseApp::InitInstance()
        CMiniFrameWnd *MiniApp = new CMiniFrameWnd();
        CString StrClassName = AfxRegisterWndClass(CS_HREDRAW | CS_VREDRAW | 
        MiniApp->Create(StrClassName, "The Fundamentals of MFC",
    		CRect(120, 100, 560, 380));
        m_pMainWnd = MiniApp;
        return TRUE;
    CExerciseApp theApp;
  6. Test the application
  7. After using it, close it and return to your programming environment



Home Copyright 2003-2007 FunctionX, Inc. FunctionX