Share via


General Window Creation Sequence

OverviewHow Do ITutorial

When you create a window of your own, such as a child window, the framework uses much the same process as that described in Document/View Creation.

All the window classes provided by MFC employ two-stage construction. That is, during an invocation of the C++ new operator, the constructor allocates and initializes a C++ object but does not create a corresponding Windows window. That is done afterward by calling the member function of the window object.

The Create member function makes the Windows window and stores its HWND in the C++ object’s public data member . Create gives complete flexibility over the creation parameters. Before calling Create, you may want to register a window class with the global function in order to set the icon and class styles for the frame.

For frame windows, you can use the member function instead of Create. LoadFrame makes the Windows window using fewer parameters. It gets many default values from resources, including the frame’s caption, icon, accelerator table, and menu.

Note   Your icon, accelerator table, and menu resources must have a common resource ID, such as IDR_MAINFRAME.

What do you want to know more about?