Creating SDI, MDI, Dialog Based Application
AIM: Creating SDI, MDI, Dialog Based Application
THEORY:
Dialog Box : A dialog box is a specialized window that is used to provide feedback or collect input from the user. Dialog boxes come in all shapes and sizes, ranging from simple message boxes that display single lines of text to large dialog boxes that contain sophisticated controls. Dialog boxes are also used for one-way communication with a user, such as “splash screens” used to display copyright and startup information as a program is launched. Dialog boxes are sometimes used to notify the user about the progress of a lengthy operation.
SDI: Single Document Interface or SDI is a method of organizing graphical user interface applications into individual windows that the operating system’s window manager handles separately. A window does not have a “background” or “parent” window containing its menu or toolbar; instead, each window contains its own menu or toolbar. Applications which allow the editing of more than one document at a time.
MDI: Multiple Document Interface (MDI) are those whose windows reside under a single parent window as opposed to all windows being separate from each other.
Advantages
• Many child windows do not fill up the OS task management interface, as they are hierarchically organized. Users simply switch applications.
• With MDI a single menu bar and/or toolbar is shared between all child windows, reducing clutter and increasing efficient use of screen space.
• All child windows for an application can be hidden/shown/minimized/maximized as a whole.
Disadvantages
• Cannot be used successfully on desktops using multiple monitors.
• MDI can make it more difficult to work with several applications at once, by restricting the ways in which windows from multiple applications can be arranged together.
• The shared menu changes, which may cause confusion to some users.
Creating SDI Application Using Visual C++:
The AppWizard In Visual C++, provides the facility of creating MDI or SDI applications. To create a simple SDI program, select Single Document on the opening MFC AppWizard screen. AppWizard displays six Wizard pages filled with default information for a typical SDI program. You can tell AppWizard to create the project for you by pressing the button labeled Finish. AppWizard will create several classes and files for you and create a project that you can use to manage the process of compiling the program AppWizard creates these classes for a program named Hello:
• CHelloApp: Derived from CWinApp, the application class for the program
• CHelloDoc: The program’s document class, derived from CDocument
• CHelloView: The program’s view class derived from CView
• CMainFrame: The main frame class for the program
In addition, AppWizard creates several files that are not used for C++ classes. Some of these files are
• hello.aps: A file that contains a precompiled version of the program’s resources
• hello.clw: A file that contains information used by ClassWizard
• hello.rc: A resource file that contains information about dialog boxes, menus, and other resources used by the program
• resource.h: A header file containing declarations needed for the resources used by the program
• hello.dsp and hello.dsw: The project and workspace files used by Developer Studio to build the program
• stdafx.cpp: A file included in all AppWizard programs that includes all the standard include files
• stdafx.h: A standard header file included in all AppWizard programs that is used to include other files that are included in the precompiled headers
Creating MDI Application Using Visual C++:
You can use AppWizard to create an MDI application almost as easily as an SDI.
The basic difference between an SDI application and an MDI application is that an MDI application must manage multiple documents and, usually, multiple views. The SDI application uses only a single document, and normally only a single view. Both SDI and MDI applications use an object called a document template to create a relationship between a view, a document, and a frame class, as well as an identifier used for the program’s menu, icon, and other resources. You use the CSingleDocTemplate class for SDI applications and the CMultiDocTemplate class for MDI applications. These two classes share a common base class, CDocTemplate.
Leave a Reply