Part V. Wizards

Chapter 2 - A Quick Start Using the IDE

Visual C++ 6: The Complete Reference
Chris H. Pappas and William H. Murray, III
  Copyright 1998 The McGraw-Hill Companies

The File Menu
The Visual C++ IDE File menu localizes the standard set of file manipulation commands common to many Windows applications. Figure 2-2 shows the command options available from the File menu.
Figure 2-2: The Visual C++ File menu
New...
The New... menu item opens a new edit dialog box window. You usually begin any new application at this point. The IDE automatically titles and numbers each window you open. Numbering begins at 1, so your first window title will always be xxx1, your second window title xxx2, and so on. The xxx is a label identifying the type of file you are working with (code, project, resource, bitmap, binary, icon, or cursor).
If you have windows titled xxx1 through xxx6 open and then decide to close the window titled xxx2, the next time you invoke the New… option that title (in this case, xxx2) will not be reused. Windows automatically supplies the next higher number (for this example, xxx7).
The quickest way to open a new edit dialog box is to click on the leftmost button on the toolbar. This button has a picture of a file on it. You can invoke the New... option directly by clicking on this control.
Open...
Unlike New..., which opens an edit dialog box window for a previously nonexistent file, the Open... menu item opens a dialog box that requests information on a previously saved file. This dialog box is the standard Open File dialog box, which displays the default drive, path, and file search parameters, and allows you to select your own.
The dialog box has a timesaving feature that automatically remembers your preferences, using these as defaults each time you use the Open... command. Attempting to open an already opened file automatically invokes an audible alert and warning message. This useful reminder prevents you from accidentally opening two or more copies of the same file, editing only one of them, and then resaving the nonupdated version!
The second button from the left on the toolbar, which has a picture of a folder with an open arrow on it, can be used to invoke the Open... option directly.
Close
The Close menu item is used to close an open file. If you have multiple files opened, this command will close the active or selected window. You can tell which window is active by looking at the window’s border. Active or selected windows have the keyboard and mouse focus and are displayed with your system’s selected color preferences. These preferences usually include colored title bars and darker window borders. Inactive windows usually have grayed title bars and window borders.
If you accidentally attempt to close an unsaved file, do not worry. The integrated environment automatically protects you from this potentially devastating scenario by warning you that the file has not been previously saved, and it asks you if you want to save the file at this point.
Save
The Save menu item saves the contents of the currently selected or active window to the file specified. You can distinguish the previously saved contents of a window from the unsaved contents of a window by simply checking the window’s title bar. If you see a default title, such as xxx1,you will know that the window’s contents have never been given a valid filename and saved. Saving a previously unsaved file will automatically invoke the Save As… dialog box.
You can also use the Save button on the toolbar. The third from the left, this button has the image of a floppy disk on it. If a file was opened in read-only mode (see the description of the View | Properties command), the control’s image will be grayed, indicating that the option is currently unavailable.
Save As...
The Save As... menu item allows you to save a copy of the active window’s contents under a new name. If you are wondering why you might choose this option, here’s a possible scenario. You have just finished a project. You have a working program. However, you would like to try a few changes. For the sake of security, you do not want to tweak the current version. By choosing the Save As... option, you can copy the file’s contents under a new name, and then you can tweak the duplicate. Should disaster ensue, you can always go back to your original file.
Save All
If you have never written a C, C++, Windows 98/95, or Windows NT application, you will be stunned at the actual number of files involved in creating a project’s executable file. The problem with the Save option is that it only saves the active window’s contents. The Save All menu item saves every window’s contents. If any window contains previously unsaved text, the Save All command will automatically invoke the Save As… dialog box, prompting you for a valid filename for each window.
Page Setup...
The most frequent use for the Page Setup... menu item is to document and format your hard copies. The Page Setup dialog box allows you to select a header and footer for each printed page, and you can use it to set the top, bottom, left, and right print margins.
Table 2-1 lists the formatting codes available for selecting the type of header and footer.
Table 2-1: Page Setup Formatting Codes
Formatting Code
Associated Use
&c
Center text
&d
Add current system date
&f
Use the file’s name
&l
Left-justify text
&p
Add page numbers
&r
Right-justify text
&t
Add current system time
Print...
Obtaining a hard copy of the active window’s contents is as simple as selecting the Print... menu item. The Print dialog box provides you with several options. First, you can choose between printing the entire window’s contents or printing only selected text by clicking on the appropriate radio button. You can also select which printer to use and configure the selected printer by choosing the Setup option.
If you wish to print only a portion of a window’s contents, you must first select the desired text. Selecting text is as simple as placing the mouse pointer on the first character in the text you want to print and holding the left mouse button down while you drag the mouse to the right and/or down through the text. This causes the selected text to be displayed in reverse video. When text is selected, the Print dialog box will show the Print Range Selection radio button in normal type (not grayed), indicating the option’s availability.
Recent File List
Right below the Print... menu item is a list of the most recently edited files. The nice feature about such lists (often called history lists) is that they are context sensitive. History lists save you time by remembering the last several items you have selected for a particular option. For this menu, the items remembered are previously opened files. The first time you use the Visual C++ IDE, this portion of the File menu is empty, because there is no history of opened files.
Recent Workspace List
The recent project list is immediately below the recent file list on the menu. This history list is similar to the recent file list, except that the recent project list contains only project files. To open any file, in either list, double-click the left mouse button on the selected item.
Exit
The Exit menu item allows you to quit the Visual C++ IDE. Do not worry if you have forgotten to save a window’s contents before selecting Exit. The IDE will automatically display a warning message for each window containing unsaved text, allowing you to save the information before exiting.

Books24x7.com, Inc 2000 –  


Visual C++ 6(c) The Complete Reference
Visual Studio 6: The Complete Reference
ISBN: B00007FYGA
EAN: N/A
Year: 1998
Pages: 207

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net