Fall, 2000
Class 1
R. Eckert


Developer Studio is a self-contained environment for creating, compiling, 
linking, and testing Windows programs--the Integrated Development Environment 
(IDE) that accompanies Visual C++, v5.0.


The Editors--

   These provide interactive environments for creating and editing:

      C or C++ source program files (text)

         Some features are: 
                   Color cues to distinguish between language elements
                   Automatic indentation
                   Generates text files

      Windows resources (icons, bitmaps, cursors, menus, dialog boxes)

         Some features are: 
                   Graphical/visual orientation
                   Integrated with the C/C++ editor
                   Generate resource script (.rc) files

The C/C++ Compiler--

   Translates source programs into machine language
   Detects and reports errors
   Generates object (.obj) files for the linker

The Resource Compiler--

   Reads resource script (.rc) file
   Generates a binary resource (.res) file for the linker

The Linker--

   Reads the .obj and .res files produced by the compilers
   Accesses C/C++/Windows libraries to obtain required modules
   Generates the executable (.exe or .dll) for the application

The Debugger--

   A powerful source code debugger
   Tightly integrated with all parts of Developer Studio
   Features: Breakpoints
             Tracing through or over functions
             Variable watch windows
             Much more


   A code generator that automatically creates working Windows program
   skeletons (only for MFC applications).


   A tool that facilitates easy extension of classes generated by
   AppWizard. Used to tailor AppWizard-generated MFC skeletons.

Online Help--

   Can be accessed in the following ways:

      By book (InfoViewer organized by books and chapters)--
         Platform, SDK, and DDK Documentation
            Platform SDK
                     Win32 Functions (Alphabetical listing)
                     Win32 Messages (Alphabetical listing)
                     Win32 Structures (Alphabetical listing)

      By topic (keyword search-->relevant topics/articles)
         [Unfortunately this feature is not working on the Pod systems here]

      If you've installed the VC++ compiler that comes with the Horton book:
         just click on Help | Index and enter the name of the item you're
         looking for.

      F1 help (instant help on item under mouse cursor)

      Online Help from the Web: MSDN (Microsoft Developer Network)--
      The easiest way to use this is to invoke the search facility at:
            And just enter the name of the function, message, etc. you need
            information on.

Other Advanced Tools--

   (SPY++, PVIEW, ActiveX utilities, a gallery of software components)


Developer Studio can be used to prepare many different kinds of
applications. We will consider only the following:

Win32 Console Applications (DOS programs)
Win32 Application Programmer Interface (API) Applications
Win32 Microsoft Foundation Class (MFC) AppWizard Applications

The following figure is the window that appears when Developer Studio is

It is divided into a menu bar, several tool bars, the "Project Workspace
Window" (to the left in the figure), the "Editor Window" (to the right),
and the "Output Window" (at the bottom).

The Project Workspace Window gives access to the online help through
the InfoView tab. When you have an application project open, the Project
Workspace Window also provides access to all the files, the C++ classes,
and the resources in the project.

The Editor Window is where you enter or modify source code and/or other
program components. This is where you will probably spend most of your
time in the development of an application. This is also where the
Debugger will send you when you double click on any error messages that
occur during execution.

The Output Window displays messages that result from compiling,
linking, and/or running your program. In addition, if you place debugging
statements (such as TRACE) in your program, the resulting output will be
sent to this window.


Developer Studio includes many toolbars (e.g., Output, Workspace,
Standard, Build, Edit, InfoViewer, Resource, etc.), each containing icons
which act as instant routes to functions available on the main menu.
Clicking a toolbar icon will perform the function directly. Some of the
toolbars may not be visible. If you need a toolbar that is not visible,
just right click on any visible toolbar on the screen. That will bring up
the popup window shown below. You can then activate any of the toolbars
by clicking on the check box next to it.

Most of the toolbars are "dockable," which means you can drag them around
and attach them to any of the Developer Studio window's borders. If you
don't dock a tool bar to a border, it becomes a "floating toolbar."


A project is a collection of interrelated source files that are compiled
and linked to generate an executable Windows program. A project workspace
is is a folder in which all the information relating to a project is
stored. (The term is also used to refer to the Developer Studio desktop
window on the screen.)

The definition of a project is stored in a file with the extension .dsp
(Developer Studio Project). It contains information about how the program
is to be created and the files it will use. It is produced when you
create a new workspace. Under Developer Studio 97 a workspace can have
multiple projects, so another file with the extension .dsw (Developer
Studio Workspace) containing information on the projects in the workspace
is also created. Both the .dsp and the .dsw files are human-readable text 

When a project is created and built (compiled and linked), Developer
Studio generates a large number of files. These will all be stored in the
workspace directory. Some of the files you will find there after a
project build are:

File Extension   Description
.dsw             Workspace file
.dsp             Project file
.c or .cpp       C or C++ language source file(s)
.h               C or C++ header file(s)
.rc              Resource script file
.res             Compiled resource file
.ico             Icon file(s) describing icons used in program
.bmp             Bitmap file(s) describing images used in program
.exe             The executable program file
.dll             Executable dynamic link library (if used)
.obj             Machine code translation of each C/C++ source file
.ilk             Incremental link file--don't have to relink everything
.pch             Precompiled header--don't have to recompile everything
.pdb             Contains debugging information (debug mode)
.idb             More debug information
.ncb             File that supports viewing classes
.aps             File that supports viewing resources
.bsc             Browser information file
.clw             File that supports ClassWizard
.opt             Holds workspace configuration
.plg             Build log file

Some of these files are enormous. (e.g., the .pch file can easily be
greater than 3 megabytes!) So, once you have your application in "final
form," you will probably want to delete everything but the source files
(.c, .cpp, .h, .rc), the executable (.exe and .dll if present), and
perhaps the project description files (.dsp and .dsw).


Developer Studio permits two versions of your program. The "Debug"
version will include information that can help you debug your program.
This will lead to more and larger files and a larger executable, but will
enable you to do things like: setting breakpoints, tracing execution, and
examining/changing variables. The "Release" version appends none of the
debugging information to the project and is optimized to generate the
most efficient (and smallest) executable module. You set the configuration

Click "Build" on the Main Menu
Select "Select Active Configuration"
Choose the desired option (Debug or Release)


Since this course is on Windows Programming, now will be the only time
we will look at console applications. These are applications that run
under DOS or in a DOS window.

The following "hello" application simply displays the message "hello
world" on a DOS screen.

Perform the following steps to create the application:

1. Get into Developer Studio. (Double click on the Microsoft Visual C++ 5.0
icon if it's on the desktop. Or Select "Start" from the task bar, then
"Programs", then "Microsoft Visual C++", then "Microsoft Visual C++ 5.0".)
The exact procedure will depend upon how Developer Studio was installed on
the system you are using. From this point on, we will use the following
shorthand notation to indicate steps like those given above:

1. Select:
   "Start | Programs | Microsoft Visual C++ | Microsoft Visual C++ 5.0"

2. Set up the new project--
      Select: "File | New" from the main menu
         Note that the resulting "New" window has the "Projects" tab chosen
      Select: "Win32 Console Application"
      Enter an appropriate name (hello) in the Project Name box
      Enter an appropriate hard disk directory path in the "Location" box
      Click "OK"

3. Enter or paste in the source program--
      Select: "File | Hew" from the main menu
         Note that the resulting "New" window has the "Files" tab chosen
         and that the "Add to Project" box is checked
      Select: "C++ Source File" and enter the file name (hello)
      Click "OK"
      Enter or paste the following code in the Editor Window:

         #include <stdio.h>
         int main()
            printf("hello world\n");
            return 0;

4. Build the project--
      Select: "Build | Build hello.exe" from the main menu

5. Execute the program (if there were no errors)--
      Click the "!" tool from the "Build MiniBar" toolbar (if present)
      or select "Build | Execute hello.exe" from the main menu

You should see a DOS box with the message "hello world". Note that
Developer Studio is nice enough to also add a prompt "Press any key to
continue" since the program would exit immediately, thereby not giving the
user a chance to see the output.

Note that at step 3, the Workspace Window (left side) has two more tabs
in addition to the InfoViewer. These are the ClassView and FileView tabs.
Selecting the FileView tab brings down a list of the source files in the
project. In this case there is only one -- the hello.cpp file. Clicking
on any of the source files brings it into the Edit Window (right side).
There are no classes in this project. The following figure indicates what
the workspace would look like with the FileView tab chosen.

Note also that, during step 4 (the project build), some messages will
appear in the Output Window. If your source file has no errors and the
project built without problem, the messages will indicate that there were
no errors. If, there were errors, the messages will indicate what the
errors were. For example, if you remove the right parenthesis from the
printf statement in hello.cpp and rebuild the program, you will get the
following messages in the Output Window:

--------------------Configuration: hello - Win32 Debug--------------------
D:\360\programs\hello\hello.cpp(5) : error C2143: syntax error : missing
')' before ';'
Error executing cl.exe.

hello.exe - 1 error(s), 0 warning(s)

If you place the cursor over the line that indicates what the error was
and click, the error message will be highlighted in the Output Window and,
in the Editor Window, a pointer (and the cursor) will appear positioned at
the line with the error. You can then fix the error (in this case by
adding the parenthesis) and build the project again.

In addition, if you place the cursor over the error message in the Output
Window and press the F1 key, a new Editor Window will appear (on top of your
program's Editor Window) with a detailed description of the error from
the online help. If you want to get back to your program, just minimize
or close the new Editor Window. In the following figure, which shows
the upper lefthand corner of the Developer Studio workspace, just click
the lower "X" button (to close) or the lower "_" button (to minimize). Do
not press the upper "X" button since that would close Developer Studio!!

One other note. If you have entered and saved a source program prior to
creating the project, you can easily add it to the project. After you have
created the new project (Step 2, above), just do the following.

A. Make sure the source file you want to add is in the same directory as
the other files in the project. This may entail copying or moving the

B. Add the file to the project--
      Select: "Project | Add To Project | Files" from the main menu
      Select the file
      Click "OK"

This is quite useful for students who work at public facilities and do
not have constant access to these facilities. They can prepare their
source programs using any machine with any convenient editor (e.g.,
Notepad or Wordpad) and save them on a floppy disk. Then when they run
Developer Studio in the public facility, they can create their project on
the machine's hard disk, copy their source file from the diskette into the
appropriate hard disk workspace directory, add it to the project (as shown
above), and build the project.

When I make assignments to students, I suggest that they follow the above
procedure. I also have them turn in with their source listings a diskette
with the project descriptor files (.dsp and .dsw), the executable (.exe),
and any source, include, and resource files (e.g., .cpp, .h, .rc, .bmp,
etc.). That way my grader or I can run their programs and also easily
rebuild them to make sure that everything's legit. By the way, to build a
project that has only the above-mentioned files, you do the following:

1. Select: "File | Open Workspace" from the main menu
      In the dialog box that appears:
         Double click the appropriate directory
         Click the .dsw file
         Click the Open button

You can then select the FileView Tab in the WorkSpace Window and select
the appropriate source file for display in the Editor Window. You can
also do the standard "Build" (step 4 above).


The safest way to exit Developer Studio is the following:

1. Select "File | Close Workspace"
2. Click the "Yes" button in the "Do you want to close all document
   windows?" message box.
3. Select "File | Exit"