If you install the EzWindows interface on your home PC using the textbook's CD-ROM and use the standard installation options, the EzWindows library will be stored in
However, a different setup is used in our lab. The library is stored in
In each the remaining labs of the course you'll be building and running Visual C++ programs. In this lab, the programming process will be explained in great detail. You should master these steps so that you can do them without reference to this lab handout in the future. In fact, you should be able to answer CSCI 201 exam questions about the steps.
You should see a large window, the primary window of the Visual C++
development environment.
You may also see
a second smaller floating window displaying the InfoViewer.
Go ahead and terminate the InfoViewer window
by pressing on the X in its upper right hand corner.
We will not use the InfoViewer window in CSCI 201 labs.
The sub-panel in the upper-left hand corner of your Visual C++
window is called the Workspace window.
It should
now look like:
Now press the down arrow at the end of the
Look in choice.
You'll see an explorer-type file menu.
Navigate through the menu until you find the EzWindows library.
Remember that,
in the RH 142 lab, the library is stored in
Go back to the Workspace window and select the FileView.
If there is a plus sign to the left of your project name,
press it. It should change to a minus sign.
Now you should be able to see that the EzWindows library
has been added to your project.
For more information on adding projects, see section F.3.2 of the textbook.
Start with the menu choices
Tools » Options....
to raise the Options dialog menu.
Select the Directories tab.
At the end of the Directories list, you
should see a blank entry. Move your mouse into that
blank and double click. The blank entry will be replaced
by a new larger blank followed by a box with three dots.
Believe it or not, if you click on the three dots, you'll get a
Choose Directory dialog. Select
the appropriate directory. In the RH 142 lab, it's
Select the Files tab and then select
C++ Source File as the file type.
Go into the File name and
enter the file name stonehenge.cpp.
Press OK. Your Workspace window should
now show the new file.
Load up our version of the program
stonehenge.cpp
by pressing on the .
Of course, once you've done that you can't read this page, so
you better come back and read a little ahead.
OK. You've followed the link and have our version
of stonehenge.cpp in your Netscape browser.
Make the menu selections Edit
» Select All.
This should cause the entire program to be high-lighted.
Now do Edit » Copy.
This makes Windows stash the program away.
By the way, the control character
keystrokes ^A ^C do the same thing.
Now come back to this Netscape page and stop reading ahead.
Move your mouse into Visual's empty C++ program window and
Edit » Paste through
the menus or ^V through the keyboard.
You execute your program with the
menu selections
By the way, the reasons we have mentioned the keystroke
shortcuts in this section is that we know
that you will be re-building your program many times.
To terminate the display, bring your mouse into the original
console window and type a control-C (^C).
Your job is to modify your program so that it gives a more
accurate rendition of the final version of Project Stonehenge.
You may have to dust off your high school geometry skills to
figure out how to size and place the spans.
First of all, make absolutely sure that you have terminated
execution of your program before you try to modify and rebuild it.
If you don't, you will get the error message:
Unfortunately, we have also noticed times in which the
stonehenge application continues to run even
after it has been terminated. We've also noticed that
sometime the application doesn't wait for you to
enter a number from the console and instead flashes
its graphics.
We don't know what causes these
problems, but we prefer to blame it on factors, such as
the Novell file system, that are beyond our control.
We do know a couple of extreme measures which seem to help.
Press on the lower tab on the Workspace window labeled FileView.
This will bring up outline-like display
of the files of your project. Right now you haven't added
any files to your project, so don't expect to see much.
Adding the EzWindows library
Adding the EzWindows library to your project isn't easy.
Start with the menu choices
Project
» Add to Project »
Files to
raise the Insert Files into Project dialog.
Press on the small down arrow just at the end
of the Files of type choice.
You'll see a long list of selections. You'll need to scroll
down the list until you file the choice
Library Files (.lib). Mash it.
but, on your home PC, you'll probably find it at
Eventually you should reach
Then you can just punch OK.
Adding the EzWindows include directory
You need to change the project options to include the
EzWindows library. This is explained fully in section F.3.3
of the text.
If you've done this before, you may already see the
EzWindows include directory, in which case you can skip
on to the next section.
At home, you'll probably want
Click OK a couple of times and the include directory
will be set properly.
Creating a C++ source file
Add a new C++ source files called
stonehenge.cpp
to your project.
Start this by going through
Project
» Add to Project »
New menu choices.
This brings up a dialog box entitled New.
Writing a C++ source file
Normally, you just start writing C++ statements into
the blank program source window.
however, today we'll give you a head start.
About that program
The calls similar to
SimpleWindow MyWin("Your name's winder", 18.0, 11.0) ;
MyWin.Open() ;
create a titled window that is 18 by 11 centimeters in size
and display it on the screen.
The calls
RectangleShape Column1(MyWin, 4.0, 8.0, Blue, 2.0, 6.0) ;
Column1.Draw() ;
create a blue rectangle (see page 375 for possible colors)
that is centered at a point 4 cm from the left edge of
the window and 8 cm from the top edge. This rectangle
is 2 by 6 cm in size.
The silliness at the beginning of the
program about having to enter the number
makes sure the console window
is displayed before the application window.
(Well of least sometimes it does.)
Building and executing the program
You can build your program with either the
menu selections
If you have errors, you'll need to use the output window's
scroll bars to actually see the error messages.
Running this program
When you start running the program, you should see a
console window asking you to:
Type an number and then you'll see
four blue columns.
This is an accurate representation of
a recently discovered initial design made by
one of the Project Stonehenge engineers.
(Actually, the engineer really specified grey columns, but
EzWindows doesn't support that color.)
Lab Assignment and Checkoff
You do this by adding four statements to your C++ programs.
These statements will define RectangleShape
objects for the two spans and draw them into the window.
What can go wrong?
The 201 lab instructors have encountered few problems testing
this assignment on the Windows NT computers in their offices.
However, a couple of problems have cropped up when using
the Windows 95 computers in the lab.
Return to CSCI 201 page
Return to the UNCA Computer Science home page