/*************************************** ***********
One of the simplest Windows MFC programming procedures
**************************************** ***********/
// Use the MFC header file
# Include <afxwin. h>
/*
Note:
Enable the program to use the MFC class library and select "Settings" in the "project" menu ". Select the General tab in the displayed dialog box. In the "Microsoft function class" combo box, select "use MFC in a shared DLL ". Then close the dialog box.
*/
// A new class is derived from the cwinapp class, which represents the current application. All features of this program are embodied in this class.
Class chelloapp: Public cwinapp
{
Public:
Virtual bool initinstance ();
};
// Create an object example. In a Windows application, one application has only one object generated from cwinapp or its derived class.
// The cwinapp class encapsulates winsdk's global functions winmain () and Windows message loop
Chelloapp theapp;
// Because Windows have various appearances and features, MFC does not include windows in the cwinapp class zhogn
// Here is the main window class for creating windows
Class chellowindow: Public cframewnd
{
Public:
Chellowindow ();
};
// The Windows application initialization does not use the constructor of the cwinapp class and its derived classes, but uses a virtual function virtual bool initinstance () to initialize the application.
// If this function returns true, the program continues to execute. If false is returned, the program exits.
Bool chelloapp: initinstance ()
{
// The variable m_pmainwnd has been defined in cwinapp, and its function is to point to the main window of the application.
M_pmainwnd = new chellowindow ();
// Display window
M_pmainwnd-> showwindow (m_ncmdshow );
// Update the control status in the window
M_pmainwnd-> updatewindow ();
Return true;
}
// Note that the CREATE () function must be called to create the window itself in the window constructor.
Chellowindow: chellowindow ()
{
Create (null, "one of the simplest MFC programs in Windows MFC programming", ws_overlappedwindow, crect (200,200 ));
}
/*
The process of creating a team image in MFC:
1. Define object types and allocate space
Example: m_pmainwnd = new chellowindow ();
2. Create of the call class itself
For example, create (null, "one of the simplest MFC programs in Windows MFC programming", ws_overlappedwindow, crect (200,200 ));
*/