Programming Windows - Multiple Document Interface


Home | API | MFC | C++ | C | Previous | Next

The multiple-document interface (MDI) enables a user to work with more than one document with multiple windows contained within a single parent window. An MDI application must register two window classes: one for its frame window and one for its child windows. At any one time, only one document window is active (indicated by a highlighted title bar), and it appears in front of all the other document windows.

Creating an MDI Application

The first step in creating an MDI application is registering the window classes. One class will be required for the MDI frame window, and another class will be required for each type of MDI child window. The class structure for an MDI frame window is like a normal application main window. The class structure for an MDI child window is filled in like the class structure for child windows with two exceptions. First, the class structure for an MDI child window should specify an ICON since the user can minimize MDI child windows within the MDI frame window. Second, the menu name should be NULL, since an MDI child window can not have its own menu.

Example

The following short program demonstrates how to create a Multiple document interface. Clicking the Menubar item file followed by the menu item new creates a new MDI child window containing a textbox.


Home | API | MFC | C++ | C | Previous | Next

Creating a Simple Window | Common Elements | Data Types and Character Sets | The Device Context | Graphics Device Interface | Displaying Text | Displaying Graphics | Mapping Modes | Keyboard Input | Working with the Mouse | Menus | Child Windows | The Dialog Box | Windows Message Box | Common Dialog Box | Bitmaps | Common Controls | Creating a Toolbar | Multiple Document Interface | Timers | DLL’s | Creating Custom Controls | Owner Drawn Controls | API Hooking and DLL Injection | File Management Functions | String Manipulation | System Information Functions

Last Updated: 15 September 2022