CS 46A Lab 5
Getting Help
Department of Mathematics and Computer Science
San Jose State University
Even the most experienced programmer, no wait, make that "especially the most experienced programmer," spends most of his programming hours searching through on-line help documents. No one remembers every single parameter of every single library function, and the experienced programmer is willing to spend an hour looking for a library function rather than spend ten minutes creating a new function that may be less reliable.
Given this fact, it seems surprising that the on-line help system is no longer integrated into the MSDS environment. In MSDS version 6.0, on-line help is accessed through a seperate program called the Microsoft Developer Netowrk (MSDN) Library Viewer, which is nothing more than a half-baked web browser together with over a gigabyte of compiled HTML documents. (So you won't be able to use Netscape to view them, although Internet Explorer version 4.0 will open them in an MSDN viewer-like window.)
The MSDN viewer is divided into three panes: tool bar, navigator, and display. MSDN documents (or ordinary web pages) are displayed in the display pane. The navigator pane is a tabbed window that allows users to choose between four search methods: table of contents, index, text search, and favorites (which is nothing more than bookmarks to the user's "favorite" documents). The tool bar provides the usual web browser controls: Back and Forward arrows for revisiting documents; Previous and Next arrows for sequentially accessing documents; a useful Locate button that shows the position of the displayed document in the table of contents; a Hide button that hides the navigation pane; and of course the familiar Home, Refresh, Stop, and Print buttons:
The MSDN viewer even contains documents about itself, located in the volume:
Welcome to the MSDN Library
MSDN Library Help
The Table of Contents
The MSDN library is divided into many volumes. Each volume may contain documents and subvolumes. Thus, the library is a tree-like structure: parent nodes are volumes, and leaf nodes are documents. The Contents tab of the navigation pane makes this tree-like structure explicit with a tree control which displays each volume as book icon next to an open(+)/close(-) button. Documents are displayed as document icons. Double clicking a document icon displays the document in the display pane.
Although there are many volumes in the MSDN library, we will only be concerened with the volume called Visual C++ Documentation. For our purposes, the most useful subvolumes are:
Visual C++ Documentation
Using Visual C++
Visual C++ Programmer's Guide
Visual C++ User's Guide
Glossary
Reference
C/C++ Language and C++ Libraries
The Programmer's Guide
The Visual C++ Programmer's Guide contains techinical information about developing programs, such as compiling and linking, debugging, preprocessing, the runtime library (which includes the standard C library), and a useful "quick reference" that can be used to look up brief documents about C/C++ operators and syntax:
Visual C++ Documentation
Using Visual C++
Visual C++ Programmer's Guide
Compiling and Linking
Debugging
Preprocessor Reference
Quick Language Quick Reference
Runtime Library Reference
The User's Guide
The Visual C++ User's Guide contains information about the Visual C++ environment, such as how to use the debugger, how to use the editor, working with projects, and the Visual C++ user interface:
Visual C++ Documentation
Using Visual C++
Visual C++ Users Guide
The Visual C++ Environment
Working with Projects
Text Editor
Debugger
The C++ Language and Library References
The Reference volume is probably the most useful volume in the library. Not only does it document all of the features of C and C++ (readers may find some of these documents more useful than their text books), it also documents the standard C++ library— which consists of the stream library and the template library (STL) —together with the pre-standard stream library. (The standard C library is documented in the Runtime Library Reference in the Programmer's Guide):
Visual C++ Documentation
Reference
C/C++ Language and C++ Library
C++ Language Reference
C Language Reference
iostream Library Reference
Standard C++ Library Reference
The title pages of the Programmer's Guide, User's Guide, and C/C++ Language and Library make excellent bookmarks. We can also restrict the table of contents (as well as the index and word search) to the Visual C++ Documentation volume by selecting that volume in the "Active Subset" text box above the Navigation window.
The Index
The Index tab of the Navigator pane displays the library's index in a list box. User's can scroll through the list box, but it's faster to type the word you're looking for into the "find keyword" text box above the list box. If the word is located in the index, it is automatically selected in the list box. Clicking the "Display" button will automatically display the corresponding document, or if there are several relevant documents, a dialog box appears displaying the choices.
For example, suppose we forget the strange syntax of the C/C++ switch statement. Typing "switch" into the find box locates "switch" in the list box. Clicking the Display button displays a dialog box containing a choice of several documents: do we want to read about the Java switch statement, the C switch statement, or the C++ switch statement? We select the C++ switch statement, and a document titled "The C++ Switch Statement" is displayed in the display pane.
As another example, suppose we forget how to use the string compare function, strcmp(). We type strcmp into the find box. strcmp is located in the list box, we press the Display button, and a document titled "strcmp, wcscmp, _mbscmp" is displayed.
Searching for Text
The Table of Contents and the Index are useful for people who already have a pretty good idea of what they are looking for. For those times when we are groping in the dark, there is text search.
For example, suppose we are looking for information about type conversion. Click the Search tab on the Navigation pane, enter "type conversion" into the "type in the words to search for" text box, make sure the Visual C++ Documentation volume is selected in the "Active Subset" text box (otherwise the entire library is searched), and press the Search button. After a while, 66 documents containing the phrase "type conversion" are listed in the list box. We can now scroll through the list box looking for a document that sounds useful.
Like all search engines, we need to be careful about limiting our search. For example, typing the phrase "type conversion" without the quotes locates 292 documents containing the word "type" or the word "phrase". Typing the phrase "type AND conversion" lists all documents containing both words, but not necessarily together.
Accessing the MSDN Viewer from MSDS
There are two ways to control the MSDN viewer from within MSDS. First, the MSDS Help menu options Contents, Index, and Search allow programmers to select the corresponding tab in the viewer's navigator pane. This is useful if the viewer isn't running, because selecting the option starts the viewer in a window that opens over the MSDS window. If the viewer is already running, the menu is nearly useless because selecting the option selects the corresponding tab, but the viewer window remains under the MSDS window.
A more popular way to get help on a name is to select it with the mouse, then press the F1 key. The viewer automatically locates all documents listed under the selected name in the index.
Context Sensitive Help
The new MSDS editor maintains a record of every variable, function, and type declaration in the current project and in the system libraries. When the user is editing a header or source file, the editor uses this data, together with the position of the insertion point or mouse cursor, to create and display useful tool tips. There are three types of help available:
Type Info
Placing the mouse cursor over a name displays the type of the name.
Parameter Info
Typing a call to a global function displays the function's parameter list.
List Members (plus comments) and Complete
Typing a definition or call to a member function displays a list of all member functions for that class. (How does the editor know which member functions to display?) The user can either select a function with the mouse, or continue typing and let the editor figure out which member function is being called. When the editor selects the correct function in the list, the user only needs to press the Enter key, and the editor automatically completes the rest. As an added bonus, when a name is selected in the list, any comments associated with the name are also displayed.
Type, parameter, and member information can also be obtained by selecting the appropriate option from the Edit menu.