The simplest MFC program for Windows MFC programming

zhaozj2021-02-16  55

/ ************************************************** * Windows MFC programming one of the simplest MFC programs ******************************************************** ************ /// Use the MFC header file #include

/ * Note: Make the program uses the MFC class library to select "Settings" of the "Project" menu. Select the "General" tab in the dialog that appears. 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 this application, all of this program is reflected in this class Class ChelloApp: public cwinapp {public: Virtual Bool InitInstance ();};

// Create an object case, in the Windows application, in an application, and only one object is from the CWINAPP or its derived class to encapsulate Winsdk global functions in the CWINAPP class WinMain () and Windows Message Cycling CheloApp THELLOAPP

// Because Windows window has a variety of appearance and characteristics, the MFC does not contain Windows master's window in CWINAPP-class zhogn / / here is the main window class Class ChellowDow: Public CFrameWnd {public: chellowindow () };

// Windows application initialization does not use the CWINAPP class and its derived constructor, but uses a virtual function Virtual Bool InitInstance () to initialize the application // This function returns the program to continue execution, return false Program Exit Bool ChelloApp :: InitInstance () {// Variable M_PMainWnd is CWINAPP has been defined, its role is to point to the main window m_pmainwnd = new chellowindowindow (); // display window m_pmainwnd-> showwindow (m_ncmdshow ); // update the control status m_pmainwnd-> UpdateWindow () in the window; Return True;}

// Note In the window of the window, you want to call the create () function to create the window itself Chellowindow :: Chellowindow () {create (Null, "Windows MFC programming one of the simplest MFC programs", WS_OVERLAPPEDWINDOW, CRECT (0, 0, 200, 200));} / * Create a team icon in the MFC: 1. Define object types and assign space such as: m_pmainwnd = new chellowindow (); 2. Create Create Create itself such as: Create (NULL, "The simplest MFC program", WS_OVERLAPPEDWINDOW, CRECT (0,0,200,200)); * /

转载请注明原文地址:https://www.9cbs.com/read-22781.html

New Post(0)