
by Don Benage
For years, Microsoft has had a goal to deliver a single Integrated Development Environment (IDE) for all its programming tools. Developers would learn how to use this environment and then write code in the language of their choice. They could even use multiple languages much more easily than if each language had its own unique IDE. Although Microsoft hasn't yet reached its ultimate goal, a huge step forward has been taken with Visual Studio.
This chapter covers some of the rudimentary tasks that you need to know to use Visual Studio. If you're an experienced developer who has already worked with a Microsoft language product, you may want to skip this chapter and proceed directly to the more advanced material in the rest of this book. If you're new to Microsoft's tool suite, this chapter will help you to get started.
Installing Visual Studio presents some special challenges due to the size of this large suite of tools. Most people probably won't need to install the entire suite. It would be a rare developer who had skills in using all the languages and tools that are part of Visual Studio. If you're sharing a system with several people who work at different times, however, or want to be able to experiment with the entire tool set, you may still want to install the entire product.
To install the entire system, you need more than 2GB of disk space. If you don't install all the online help files but instead run them from CD-ROM, you can save a substantial amount of space. However, the shared components alone require up to 300MB. You also should remove earlier standalone versions of any languages in the suite (for example, Visual Basic 4.0). Finally, you should allow plenty of time for the operation. Installation times vary widely depending on the speed of your computer's CD-ROM drive, hard disk(s), and internal clock; however, installation can easily take more than three hours to install everything.
Furthermore, Visual Modeler--a design and modeling tool described in Chapter 27, "System Modeling and Microsoft Visual Modeler"--isn't included on the CD-ROM set at the time of this writing and must be downloaded from Microsoft's web site. Also, a specialized tool called the Microsoft Repository (described in Chapter 28, "The Microsoft Repository") isn't included in the main installation menu that's offered by the CD-ROM's AutoPlay feature. You must manually locate and launch the individual setup program for this tool.
Finally, two service patches (SPs) for the Visual Studio product had been released as this book went to press, and undoubtedly additional SPs will be offered in the future. In general, Microsoft patches are always cumulative so that you'll require only the most recent one; you don't need to apply a series of patches in order (see the later section "Applying a Service Patch" for more information).
NOTE: The second SP was offered in two forms: a core patch with fixes required by most users (approximately 34.6MB) and a complete patch with all fixes available at the time (87.8MB). Even with a relatively high-speed link to the Internet, downloading this patch is somewhat daunting. You may choose to download or order it on CD-ROM and have it shipped to avoid the time and connect charges you might incur.
All these potential hurdles notwithstanding, after you assemble the CD-ROMs and any appropriate SPs, uninstall any old versions, and check your hard disk to verify that you have enough space, you're ready to proceed. Although the process can be time-consuming, it's not difficult if you follow the basic guidelines offered in the following sections.
NOTE: If you're installing multiple language products, you'll be asked to restart your machine after some of the individual products are installed. It's recommended that you take the time to restart your machine any time you're prompted to do so, even if you intend to install additional products. This isn't always required. If the setup program doesn't prompt you to restart, you may safely proceed with the next product without rebooting.
When you launch the setup program, as described shortly, you'll first be prompted with some Helpful Installation Hints. Although it generally doesn't matter in which order you install the various tools and languages, you should install the Microsoft Developer Network (MSDN) Library last, because this component checks to see which other components you've installed and adds support information for only those tools and languages it finds. To ensure that you have the support files for all the languages and tools you're using, install the MSDN Library after everything else is properly set up.
You'll also be prompted to upgrade your version of Internet Explorer (IE) to at least version 3.01. If you already have installed a later version of IE, you may safely ignore this request. Otherwise, you should install the upgrade to 3.01 from the CD-ROM or install an even more current version from the Microsoft web site before starting the installation program for other languages and tools.
To install Visual Studio, follow these steps:
NOTE: The Master Setup program is available on all CD-ROMs in the box. If you know you want to begin with a product not on Disc 1 (such as Visual C++), you can start the Master Setup program with that CD-ROM and avoid the need to swap CD-ROMs as described later in step 7. If you're installing the entire suite, it's recommended that you proceed in the order in which the CD-ROMs are numbered.
FIG. 2.1
The Visual Studio Master Setup menu allows you to begin the installation process
for all languages and most of the add-on utilities.
FIG. 2.2
The Visual C++ submenu contains the C++ language and additional companion products
and Software Development Kits (SDKs).
FIG. 2.3
The Installation Options dialog box shows you the disk space requirements for the
files to be installed or those to be added if you're running setup at a later time
to modify your original installation.
FIG. 2.4
If you want to use Visual Studio to debug Transact-SQL statements as they're executed
on your SQL Server database, follow the instructions to install the appropriate files
on your SQL Server.
Repeat these steps with any remaining products or SDKs you want to install. Remember that if you're prompted to restart your machine, you should take the time to do so, and launch the Master Setup program again to continue. If you aren't prompted to reboot, you can continue with the next product immediately.
After you install all the languages, tools, and SDKs you plan to use, you're ready to apply any service patches that have been released. This important part of the installation process can save you hours of aggravation later. Although running your new tool suite may be tempting, it's a good idea to check the Microsoft web site if you haven't already done so, download any appropriate patches, and apply them at this time.
Microsoft provides service patches, which include a cumulative set of all bug fixes, for all products used for corporate information systems, including their operating systems.
ON THE WEB:Service patches are available at no charge (except connect time) on Microsoft's web site at http://www.microsoft.com/vstudio/sp/. The web page provides complete instructions for installing the latest patch. In general, installation requires nothing more than simply running a setup program, verifying that the default actions to be taken are acceptable, waiting for some files to be copied, and then rebooting your machine after the patch is applied.
In addition to the service patches is a wealth of troubleshooting information in Microsoft's Knowledge Base, an online database of problems and their fixes (see the later section "Where to Get More Help").
Developer Studio is a powerful IDE that supports application development with Visual C++, Visual J++, and Visual InterDev. You also can use it to view much of the online information available to support your development efforts. The use of Developer Studio to view information is covered later in the section "Where to Get More Help," which provides a basic introduction to using the IDE for writing and debugging applications.
In this example, you'll create a blank project and workspace, open a sample application provided with Visual Studio, build the application, and use some basic debugging techniques. The language used is Visual C++. Similar features exist for other languages, although there are differences. The most powerful debugging is available with Visual C++, with reasonably good debugging features for Visual J++. There's substantially less assistance when debugging Visual InterDev at this stage in the product's development.
Most of the sample applications are distributed in compressed form. To prepare a sample application for use, follow these steps:
NOTE: Don't confuse the Search toolbar button with the Find in Files button. Find in Files is represented by a pair of binoculars with a yellow file folder and is nearer the middle of the toolbar.
FIG. 2.5
The Search dialog box can be used with the index of topics or by using the Query
tab to formulate a query.
c:\program files\devstudio\samples\sdk\win32\generic
FIG. 2.6
The Generic application is a minimal Windows application with a main window, menu
bar, and a Help menu with an About command that displays an About dialog box.
You're now ready to create a project and a corresponding workspace, load files into the project, change settings for your project, build the application, and do some simple debugging. To use Developer Studio for these tasks, follow these steps:
FIG. 2.7
The New dialog box allows you to create new workspaces, projects, applications,
and other types of files and documents.
FIG. 2.8
The EXTRA_LIBS option is set to Version.lib in this makefile, indicating
that the library file is needed for this application to build properly.
FIG. 2.9
The Project Settings dialog box allows you to make project-specific changes to
the compiler and link options.
FIG. 2.10
The Build minibar has toolbar buttons that control the build and debug processes.
You've created a project and learned how to compile and link your application into an executable program or module. This rudimentary process is the basis for any build process you might run. But Developer Studio is used for more than just building applications. It's also a powerful debugging tool that helps you find any errors in your code and correct them.
You'll now learn some rudimentary debugging capabilities offered by Developer Studio. These techniques are only the beginning. Many sophisticated techniques involve writing code specifically to aid the debug process and other skills beyond the scope of this book. This section will familiarize you with the basics and get you started. This example uses the results of the previous two procedures, which loaded and built the Generic sample application provided with Visual Studio.
To debug a Visual C++ application, follow these steps:
FIG. 2.11
A breakpoint is added at the statement that displays the About dialog box for this
application.
FIG. 2.12
The Generic application is only a shell. The only functionality that's provided is
the About box and some very rudimentary behavior from menus, minimize buttons, and
so forth.
FIG. 2.13
The Debug toolbar provides complete control over the debug process, allowing you
to Step Into, Step Over, or Step Out of procedure calls.
TIP: If you need only the value of a single variable, you don't even need the QuickWatch window. Simply select the variable and position the mouse pointer over the name. A tool tip will pop up over the name with the current value of the variable (see Figure 2.15).
FIG. 2.14
The QuickWatch window is a fast and easy way to check the values of one or more
variables or expressions.
FIG. 2.15
Using tool tips to display the value of a variable eliminates the need for watch
windows if you need only one value and don't want to change anything.
You've now had a little first-hand experience in using the Developer Studio debugging environment. You may want to explore other advanced features, such as viewing the contents of memory locations, checking the contents of CPU registers, viewing a disassembly of your C++ program into machine instructions, and others. Many of these features are accessed by simply clicking a toolbar button or making a menu selection. Feel free to try these out with the Generic sample or explore the other sample applications provided with Visual Studio.
As already pointed out, Visual Basic doesn't share the Developer Studio IDE with Visual C++, Visual J++, and Visual InterDev. Microsoft will address this undesirable situation sometime in the future. In the meantime, the good news is that the IDE for Visual Basic is a powerful and friendly environment in its own right and offers some nice features not found in Developer Studio. Perhaps the best features of both environments will eventually be merged into a single, ultimate environment.
Until that goal is reached, many developers will be faced with learning how to use two different environments. Although this task isn't particularly difficult, it's at least annoying. And switching back and forth between the two inevitably causes moments of irritation as you try to use a feature from one environment while in the other. Be that as it may, this section introduces you to the main features of the Visual Basic environment and helps you become comfortable with its features.
To use the Visual Basic IDE, follow these steps:
FIG. 2.16
The Visual Basic IDE is visible behind the New Project dialog box, which you can
open at any time by choosing File, New Project
from the menu.
NOTE: The WinSeek sample application is a utility that searches for files based on a file specification you enter. You can use the ? and * wildcard characters in the specification. You can also use a simple tree control to select the folder in which to begin your search. Subfolders are automatically included in the search. The number of matching files is counted, and full pathnames to each are provided in a result window.
FIG. 2.17
The Visual Basic IDE with the WinSeek sample application loaded and the primary form
visible.
FIG. 2.18
Right-clicking most objects in the Visual Basic IDE displays a context-sensitive
pop-up menu of appropriate actions you may want to take.
FIG. 2.19
A breakpoint is indicated by a circle in the left margin of the code window and
by a different colored highlight.
Depending on where you set your breakpoints, the application's main form will soon appear and the application is running.
You can use the application as you would normally, until you hit a breakpoint. At that time, the Visual Basic IDE will receive focus, and the code module now running appears with the current breakpoint highlighted (see Figure 2.20).
FIG. 2.20
The Visual Basic IDE allows you to dock toolbars on any edge of the window. (The
Debug toolbar is shown at right.)
When you hit a breakpoint, you can use several techniques to investigate the current state of your running application:
FIG. 2.21
You can add a variable or property to the watch window with a simple drag-and-drop
operation.
FIG. 2.22
To complete a command by using the syntax help feature, select the option you
want from the menu and press Tab to continue.
When you're through investigating the current state of your application, you can continue execution in various ways. You can simply press the Run toolbar button again to continue execution until (and if) you hit another breakpoint. You can also use the Step Into, Step Over, and Step Out toolbar buttons (refer to Figure 2.20), which let you control whether to continue at the next statement within the current module, skip a module altogether, or continue execution at the first statement immediately following the current module.
Although this overview of the Visual Basic IDE is by no means exhaustive, it should provide you with a basic feel for its use and allow you to orient yourself so that you can continue exploration on your own. At any time while using the IDE, press the F1 key for help. The next section presents other sources of help.
FIG. 23
Printing a value in the Immediate window is sometimes a more expedient
alternative than using the watch window.
Each language product in Visual Studio has multiple options for getting help--some particular to the individual language and some shared across all Visual Studio products. In this section, you learn how to use various sources for additional information.
With the rapid rate of change that's now common among software development products, the tool many developers prefer to use first is Microsoft's web site. Microsoft has made a large and on-going investment in providing a wealth of background information, bug fixes, downloadable update files, and the latest news through http://www.microsoft.com.
Visual Studio's primary web page is at http://www.microsoft.com/vstudio. Go here for the latest news, pricing and upgrade information, frequently asked questions (FAQ), white papers, datasheets, evaluation guides, and ordering information.
You can download service patches from http://www.microsoft.com/vstudio/sp. Here you'll find not only the latest service patch itself, but also instructions for applying it, a list of the problems it fixes, frequently asked questions, and links to related Knowledge Base articles describing specific problem scenarios. You can download the appropriate patch directly or order a CD-ROM containing the patch because it may be quite large.
As mentioned earlier, the Microsoft Knowledge Base is a large database of known problems and their fixes. Although you can't always find your specific problem in the Knowledge Base, it's usually worth checking to ensure that the difficulty you're experiencing hasn't already been diagnosed and fixed. If you want to go directly to the Microsoft Knowledge Base, visit http://www.microsoft.com/kb/default.asp. This URL takes you to a query page where you can enter keywords related to your problem or question (see Figure 2.24).
In addition to the various online options, a wealth of information is on the Visual Studio CD-ROMs. Although this information is obviously not as up-to-date as the web site, it's available anytime and is a great source of background information and tutorial-type information that isn't subject to change frequently. During installation, you can choose to install this information directly to your hard disk or leave it on the CD-ROMs. If you have lots of hard disk space, it's clearly faster and easier to access this information directly from the hard disk. However, because of the vast amount of supporting information included in Visual Studio (more than 1GB), most people are willing to trade the moderate inconvenience of having to occasionally swap CD-ROMs for the savings in disk space.
FIG. 2.24
The Microsoft Knowledge Base is an online database of problems and their fixes,
complete with a query tool and search engine.
Two primary sources of information are available on CD-ROM in the Visual Studio product. The first is the Visual Studio edition of the MSDN Library CD-ROM. Also, the entire set of Visual Basic documentation is available in the form of Books Online and can be loaded independently of other reference materials.
You can view the MSDN Library CD-ROM directly in the Developer Studio IDE through the use of the InfoViewer. This application, designed as an integral component of Developer Studio, can be used to read the entire set of Visual C++ documentation. Also, you can use the built-in query capability to search for information on any topic. It can even be used to view HTML files, graphics files, Microsoft Word documents, Excel spreadsheets, and many other types of files.
Developer Studio includes multiple windows that you can dock, float, and resize as needed. Docked windows all share the same rectangular window and are separated by panes that you can drag to resize the various openings. Floating windows and toolbars exist as independent windows, which can be tiled, cascaded, or manually adjusted to facilitate viewing.
To use the InfoViewer, follow these steps:
FIG. 2.25
The Developer Studio IDE includes a hierarchical folder directory in the Workspace
window on the left that can be used to select a topic for viewing.
Although the Visual Basic documentation hasn't been incorporated yet into the Developer Studio IDE, you can use it in a similar fashion by launching the Books Online application. While not integrated into the same workspace as your software development, Books Online is a convenient, easy-to-use application that lets you read the VB documentation onscreen or to search for specific information. You can also place electronic "bookmarks" to flag an important topic, making it easy to find and review later. To use Visual Basic Books Online, follow these steps:
FIG. 2.26
Visual Basic Books Online uses a dual pane display window that you can resize
or configure to your preferences.
TIP: Entering two separate words in the Find box results in a search for one word or the other. If you want to search for a two-word combination (such as ActiveX document), enclose the phrase in quotation marks so that it will be treated as a single phrase rather than a group of individual words.
You've learned about the primary web-based and CD-ROM-based resources available to Visual Studio users in search of additional information. These resources, combined with the information found in the rest of this book, should help make you an effective developer of applications with the latest techniques and designed to run in the sophisticated environments found in most organizations today.
Although the goal of a single IDE for working in all languages still hasn't been attained, Microsoft has delivered a highly integrated and powerful multiple-language development tool suite with Visual Studio. This chapter touches on the highlights of its usage and should serve as a good beginning. Individual developers, however, usually have particular preferences as to how their environment should be configured. Microsoft has designed Developer Studio and the Visual Basic IDE to be highly customizable. As you work with the individual tools, you'll discover the methods and settings you find most effective and desirable. You can create the workspace most useful for you and automatically load those settings each time you use Visual Studio.
For more information on some of the topics addressed in this chapter and where to go next in your exploration of Visual Studio 97, see the following chapters:
© Copyright, Macmillan Computer Publishing. All rights reserved.