[Prev] [Next]

Contents of ObjectWindows Tutorial


Introduction

Getting started
Tutorial application
Tutorial steps
Files in the tutorial
Typefaces and icons used in this book

Step 1: Creating a basic application

Where to find more information

Step 2: Handling events

Adding a window class
Adding a response table
Event-handling functions
Encapsulated API calls
Overriding the CanClose function
Using TDrawWindow as the main window
Where to find more information

Step 3: Writing in the window

Constructing a device context
Printing in the device context
Clearing the window
Where to find more information

Step 4: Drawing in the window

Adding new events
Adding a TClientDC pointer
Initializing DragDC
Cleaning up after DragDC
Where to find more information

Step 5: Changing line thickness

Adding a pen
Initializing the pen
Selecting the pen into DragDC
Changing the pen size
Constructing an input dialog box
Executing an input dialog box
Calling SetPenSize
Cleaning up after Pen
Where to find more information

Step 6: Painting the window and adding a menu

Repainting the window
Storing the drawing
TPoints
TPointsIterator
Using the array classes
Paint function
Menu commands
Adding event identifiers
Adding menu resources
Adding response table entries
Adding event handlers
Implementing the event handlers
Where to find more information

Step 7: Using common dialog boxes

Changes to TDrawWindow
FileData
IsDirty
IsNewFile
Improving CanClose
CmFileSave function
CmFileOpen function
CmFileSaveAs function
Opening and saving drawings
OpenFile function
SaveFile function
CmAbout function
Where to find more information

Step 8: Adding multiple lines

TLine class
TLines array
Insertion and extraction of TLine objects
Insertion operator <<
Extraction operator >>
Extending TDrawWindow
Paint function
Where to find more information

Step 9: Changing pens

Changes to the TLine class
Pen access functions
Draw function
Insertion and extraction operators
Changes to the TDrawWindow class
CmPenColor function
Where to find more information

Step 10: Adding decorations

Changing the main window
Creating the status bar
Creating the control bar
Constructing TControlBar
Building button gadgets
Separator gadgets
Inserting gadgets into the control bar
Inserting objects into a decorated frame
Where to find more information

Step 11: Moving to MDI

Understanding the MDI model
Adding the MDI header files
Changing the resource script file
Replacing the frame window header file
Adding the MDI client and child header
files
Changing the frame window
Creating the MDI window classes
Creating the MDI child window class
Declaring the TDrawMDIChild class
Creating the TDrawMDIChild functions
Creating the TDrawMDIChild
constructor
Initializing data members
Initializing file information data
members
Creating the MDI client window class
TMDIClient functionality
Data members in TDrawMDIClient
Adding response functions
CmFileNew
CmFileOpen
GetFileData
Overriding InitChild
Where to find more information

Step 12: Using the Doc/View programming model

Organizing the application source
Doc/View model
TDrawDocument class
Creating and destroying TDrawDocument
Storing line data
Implementing TDocument virtual
functions
Opening and closing a drawing
Saving and discarding changes
Accessing the document's data
TDrawView class
TDrawView data members
Creating the TDrawView class
Naming the class
Protected functions
Event handling in TDrawView
Defining document templates
Supporting Doc/View in the application
InitMainWindow function
InitInstance function
Adding functions to TDrawApp
CmAbout function
EvDropFiles function
EvNewView function
EvCloseView function
Where to find more information

Step 13: Moving the DOC/View application to MDI

Supporting MDI in the application
Changing to a decorated MDI frame
Changing the hint mode
Setting the main window's menu
Setting the document manager
InitInstance function
Opening a new view
Modifying drag and drop
Closing a view
Changes to TDrawDocument and TDrawView
Defining new events
Changes to TDrawDocument
Property functions
New functions in TDrawDocument
Changes to TDrawView
New functions in TDrawView
TDrawListView
Creating the TDrawListView class
Naming the class
Overriding TView and TWindow virtual functions
Loading and formatting data
Event handling in TDrawListView
Where to find more information

Step 14: Making an OLE container

How OLE works
What is a container?
Implementing OLE in ObjectWindows: ObjectComponents
Adding OLE class header files
Registering the application for OLE
Creating the registration table
Creating a class factory
Creating a registrar object
Creating an application dictionary
Changes to TDrawApp
Changing the class declaration
Changing the class functionality
Creating an OLE MDI frame
Setting the OLE MDI frame's application connector
Adding a tool bar identifier
Changes to the Doc/View classes
Changing document registration
Changing TDrawDocument to handle embedded OLE objects
Changing TDrawDocument's base class to TOleDocument
Constructing and destroying TDrawDocument
Removing the IsOpen function
Reading and writing embedded OLE objects
Changing TDrawView to handle embedded OLE objects
Modifying the TDrawView declaration
Changing TDrawView's base class to TOleView
Removing DragDC
Constructing and destroying TDrawView
Modifying the Paint function
Selecting OLE objects
Where to find more information

Step 15: Making an OLE server

Converting your application object
Changing the header files
Changing the application's registration table
Changing the application constructor
Hiding a server's main window
Identifying the module
Creating new views
Changing the About dialog box's parent window
Modifying OwlMain
Changes to your Doc/View classes
Changing header files
Changing the document registration table
Program identifier and description
Making the application insertable
Setting the server's menu items
Specifying Clipboard formats
Changing the view notification functions
Adding new members to TDrawView
Adding a control bar
Cutting and copying data
Handling ObjectComponents events
Removing calls from the Paint and mouse action functions

Step 16: Making an OLE automation server

Changing the application class
Including the automation and Step 16 header files
Add the /automation command-line switch to the application registration table
Declaring and implementing member functions that can be exposed as properties and methods
Exposing properties and methods to other applications
Declaring properties and methods
Defining properties and methods
Changing the document class
Including the automation and Step 16 header files
Update the document registration table
Declaring and implementing member functions that can be exposed as properties and methods
Updating the constructor and destructor of the document class
Exposing properties and methods to other applications
Declaring properties and methods
Defining properties and methods

Step 17: Enhancing the linking and embedding capabilities of an OLE container / server

Changing the line class
Adding new data members
Updating the constructor
Adding new member functions
DrawSelection
UpdateBound
UpdatePosition
Invalidate
Changing the document class
Saving individual lines
Opening individual lines
Updating line boundaries when a document is opened
Changing the view class
Adding new data members
Naming the Clipboard format
Adding the Select, Cut, Copy, and Pen commands
Implementing the Select function
Implementing the PaintLink function
Implementing or enhancing OLE message handlers
EvOcViewClipData
EvOcViewGetItemName
EvOcViewSetLink
EvOcViewPartsize
EvLButtonDown
Adding a TOleLinkView class
Adding non-OLE enhancements to the drawing application

For further study

[Prev] [Next] [Contents]