{*******************************************************}
{                Read Me File re                        }
{       Ole Automation Controller for Delphi 1.0        }
{       by Roger Headrick (Compserv 76114,1430)         }
{       contributed to public domain 12/23/95           }
{                                                       }
{*******************************************************}

Files: OleCtlr.pas - Ole Automation Controller component and
                     descending Word.Basic controller.
       CtlrDemo.pas - Demo form.
       OleADemo.dpr - Demo project file.

Notes: 	

The OleCtlr class has only been tested with Word 7.0 in Win95 os.
It is intended to be a base class for Object specific controllers.
You are free to use it or change it at your own risk. 
There are no warranties that it works for any purpose. 
          
Compiling

The Delphi patch must be applied to the Delphi VCL before compiling
the OleCtlr unit. The OleCtlr unit makes calls to procedures that
were changed by the patch.

Passing Pointers vs. Passing By Reference

In the Ole2 and Dispatch units which ship with Delphi 1.0,
pointer paramaters in Ole functions were declared as passed
by reference("Var").  This made some of the declared Ole functions
unusable, since there are certain instances when you must pass a
Nil pointer to an Ole function.  The Delphi patch corrected some
but not all of these declarations.  In the OleCtlr unit, the
IDispatch class is redeclared so that nil pointers can be passed to
the Invoke method.  If you have the source code to the Dispatch unit,
you may want to modify the Invoke method there and eliminate the
redeclaration in OleCtlr.

TWordCtlr Class As A Component

The TOleCtlr class is derived from TComponent so that a useful
derived class of TOleCtlr could be made into a Delphi component.
The TWordCtlr class in the OleCtlr demo was not intended to be
used as a component as is, since it has no published properties
except those inherited from TComponent, and it really does not have
enough methods, as is, to be considered useful.  It is suggested that
TWordCtlr be used as a non-component class until you have added and
fully tested all the Word basic commands you want and added whatever
published properties that would be appropriate.  The same can be said
for any other derived class of TOleCtlr.

Viewing and Using Ole Automation Objects

If you are interested in writing an object controller, such as TWordCtlr,
I suggest that you download the file Ole2V.EXE from MSL ( it may
also be in the WinObj libraries).  It contains a program which
allows you to view the objects that are registered on your system,
and in some cases such as Word and Excel, displays the available methods
and properties that can be called. If an object is registered
AND has an IDispatch class, you should be able to call its methods using
a derived class of TOleCtlr.

OLE Automation vs. DDE

In many cases, you can accomplish a task using either Ole automation
or DDE. However, Microsoft seems to be only supporting Ole automation
in its newer applications. For example, Microsoft mail products
such as Exchange can be controlled through either Ole or MAPI,
but not DDE.  Microsoft Schedule+ can be controlled through Ole
but does not support DDE.  Non Microsoft apps tend to support DDE but
not OLE automation, however this may be changing as developers become
more familiar with Ole automation.

TOleCtlr Testing and Logic

TOleCtlr and TWordCtlr were tested ONLY with WinWord 7 and worked
fine.  The code is based on published C/C++ examples.
The CreateOleObject method was not made part of TOleCtlr's
constructor so that (1) you can create and destroy any number
of Ole objects (by calling CreateOleObject and then FreeOleObject)
with out having to create and destroy the Delphi object, and (2)
OLE errors will not prevent TOleCtlr from being constructed.
When testing or using the Word.Basic object, please note that
when initially created a Word.Basic object has no open document
unless WinWord is already running.  Therefore you must open a
document through the FileNewDefault, FileNew, or FileOpen
commands before calling document related commands, otherwise
you will get a "Command not available" error.

Passing Multiple Arguments

If you call an Ole object's method which requires multiple arguments,
you should pass the Invoke method a pointer to the first element
of an array of Variants for varArg.  Each element in the array
should be intialized with a call to AssignArgument and released
with a call to VarClear.  The arguments must be passed in
reverse order.  For example, if you are invoking an Ole object's
method defined as Proc(integer, string), you would pass a
pointer to a Variant array having 2 elements, the first element
being the string argument and the second element being the
integer argument.

---END---	