Hosted by
|
The ObjectWindows 2.5 tutorial teaches the fundamentals of programming
for Windows using the ObjectWindows application framework. The tutorial is comprised of an
application that is developed in twelve progressively more complicated steps. Each step up
in the application represents a step up in the tutorial's lessons. After completing the
tutorial, you'll have a full-featured Windows application, with items like menus, dialog
boxes, graphical control bar, status bar, MDI windows, and more.
This tutorial assumes that you're familiar with C++ and have some
prior Windows programming experience. Before beginning, it might be helpful to read
Chapter 1 of the ObjectWindows Programmer's Guide, which presents a brief, nontechnical
overview of the ObjectWindows 2.5 class hierarchy. This should help you become familiar
with the principles behind the structure of the ObjectWindows class library.
For more detailed technical information on any subject discussed in
this book, refer to the ObjectWindows Programmer's Guide and the ObjectWindows Reference
Guide.
Getting started
Before you begin the tutorial, you should make a copy of the
ObjectWindows tutorial files separate from the files in your compiler installation. Use
the copied files when working on the tutorial steps. While working on the tutorial, you
should try to make the changes in each step on your own. You can then compare the changes
you make to the tutorial program.
Tutorial application
The tutorial application that you'll build when following the steps
in this book is a line drawing application called Drawing Pad. While this application
isn't very fancy, it does demonstrate many important ObjectWindows programming techniques
that you'll use all the time in the course of your ObjectWindows development. Each step
introduces a small increment in the application's features. You start with the most basic
ObjectWindows application and, by the time you're finished with the last step, you'll have
created a full-featured Windows application with a tool bar with bitmapped buttons on it,
multiple document support, a status bar that displays menu and button hints, and even full
OLE 2.0 server support.
Tutorial steps
Here's a summary of each step in the tutorial:
- In Step 1, you'll learn how to
create the basic ObjectWindows application. This application has no real function except
to show that an application is running.
- In Step 2, you'll learn how to use
the ObjectWindows event-handling mechanism called response tables.
- In Step 3, you'll learn how to
write text into a window by creating a device context object in the window and calling
some of the device context object's member functions.
- In Step 4, you'll learn how to draw
a line in a window using more functions of the device context object.
- In Step 5, you'll learn how change
the size of the pen that you use to draw lines in the window. You'll also learn how to use
a dialog box to get simple string input from the user.
- In Step 6, you'll learn how to take
over the window's paint function, along with adding a menu to the window.
- In Step 7, you'll learn how to use
some of the Windows common dialog boxes, specifically the File Open dialog box and File
Save dialog box. You'll also learn how to check whether your application is ready to close
when requested to do so by the user or the system, giving the application a chance to save
files or clean up.
- In Step 8, you'll learn how to
display and paint more than one line in the window using an array container to hold the
information about all the lines in the drawing.
- In Step 9, you'll learn how to
change the pen in the device context to let the user change the line color.
- In Step 10, you'll learn how to add
decorations to the application, including a tool bar with bitmapped buttons on it and a
status bar that displays hint text for menu items and tool bar buttons.
- In Step 11, you'll learn how to
create a Multiple Document Interface (MDI) application, which lets the user of the
application have a number of drawings open at once.
- In Step 12, you'll create a
Doc/View application. Doc/View provides a programming model that lets you separate the
object that actually contains your data (the document) from the object or objects that
display your data on-screen (the views). This application is actually a Single Document
Interface (SDI) application like Step 10.
- In Step 13, you'll combine the
lessons of Step 11 and Step 12 to create an MDI Doc/View application.
- In Step 14, you'll learn to create
an OLE 2.0 container from an MDI Doc/View application.
- In Step 15, you'll learn to create
an OLE 2.0 server.
- In Step 16, you'll learn to create
an OLE 2.0 automation server.
- In Step 17, you'll learn how to
enhance an OLE 2.0 automation server.
- Step 18 provides you with some
references to help you learn more about ObjectWindows.
Files in the tutorial
The tutorial is composed of a number of different source files:
- The project file is STEPS.IDE
located in bc5\Examples\owl\tutorial. Open this project in the IDE to easily access and
build each STEPXX.CPP file.
- Each step of the tutorial is
contained in a file named STEPXX.CPP.
- Later steps in the application use
multiple C++ source files. The other files are named STEPXXDV.CPP.
- A number of steps have a header
file containing class definitions and the like. These header files are named STEPXXDV.H.
- A number of steps also have a
corresponding resource script file named STEPXX.RC. In each
case, XX is a number from 01 to 18, indicating which step of the tutorial is in
the source file. Note that only steps 1 through 12 are covered in this version of the
tutorial. Code for the additional OWL steps is provided.
Typefaces and icons used in this book
The following table shows the special typographic conventions used
in this book.
Typeface |
Meaning |
Boldface |
Boldface type indicates language
keywords (such as char, switch, and begin)
and command-line options (such as -rn). |
Italics |
Italic type indicates program
variables and constants that appear in text. This typeface is also used to emphasize
certain words, such as new terms. |
Monospace |
Monospace type represents text as
it appears on-screen or in a program. It is also used for anything you must type literally
(such as TD32 to start up the 32-bit Turbo Debugger). |
Menu|Command |
This command sequence represents a
choice from the menu bar followed by a menu choice. For example, the command
"File|Open" represents the Open command on the File menu. |
Text |
This information is updated for OWLNext |
Note:This indicates material of which you should take special notice.
Prev
Up
Next
|