
                     SAMPLE OLE CLIENT: CLIDEMO
                     ==========================

CLIDEMO is a sample object linking and embedding (OLE) client application 
that works with the SRVRDEMO sample server application to demonstrate the
use of OLECLI.DLL and OLESRV.DLL.

The first step in using these applications is to run CLIDEMO.

Note: SRVRDEMO does not register itself with the registration database. 
Please see the SRVRDEMO abstract for information on registering the server.

Inserting an embedded object
----------------------------

To insert an embedded object into CLIDEMO, choose the Insert Object command. 
A dialog box containing a list box lets you select from different classes
of objects. Choose the Server Demo command and click OK. SRVRDEMO is now 
visible. Because SRVRDEMO displays a default object, you can choose the File
Exit command to exit the server without making further modifications. 
A message box prompts you to update the client. Click Yes. SRVRDEMO exits 
and the object previously seen in SRVRDEMO is now visible in CLIDEMO.

Editing an embedded object
--------------------------

To edit the embedded object, choose the Edit Server Demo Object command from 
CLIDEMO. A cascading menu shows the verbs that SRVRDEMO supports. Choose the 
Edit command. SRVRDEMO is now visible with the object displayed in its 
client area. SRVRDEMO lets you change the object's size and color. For 
example, if you choose the Color Gray command, the object becomes gray in 
color. Choose the File Exit command and click Yes in the update changes
message box. SRVRDEMO exits and the updated object appears in CLIDEMO's 
client area with its new color.

Playing an object
-----------------

Playing or activating an object is similar to editing an object. To play the 
SRVRDEMO object, choose the Edit Server Demo Object command from CLIDEMO and 
choose Play from the cascading menu. You will hear about 25 beeps from the 
PC speaker. You can also play a SRVRDEMO object by double-clicking the 
object in CLIDEMO. The server defines what the verbs mean. The OLE user 
interface guidelines state that double-clicking the object invokes the 
primary verb which, in SRVRDEMO's case, is Play. Changing the primary verb 
requires modifications to SRVRDEMO and is beyond the scope of this 
discussion. 

Note that SRVRDEMO disappears after you play an object, although Heap Walker 
shows that SRVRDEMO is still loaded in memory. OLE lets you play objects 
of the same class quickly because the server does not have to be reloaded 
into memory each time you play an object. SRVRDEMO is unloaded from 
memory when you exit CLIDEMO if no other client applications containing
a SRVRDEMO object are currently loaded.
 
Inserting a linked object
-------------------------

Before inserting a link in CLIDEMO, run SRVRDEMO. Choose SRVRDEMO's File 
Save command, enter the file name TEST.SD, and click OK. The Edit Copy 
command causes SRVRDEMO to place the Native, OwnerLink, ObjectLink, 
METAFILEPICT, and BITMAP formats on the clipboard. Exit SRVRDEMO by 
choosing the File Exit command. Choose Edit Paste from CLIDEMO. A linked 
object appears in CLIDEMO's client area. You can play and edit this 
object exactly as you play and edit an embedded object.

Changing link properties
------------------------

Choose the Edit Links command from SRVRDEMO to display the Links dialog 
box. This dialog box lets you edit an object, play/activate an object, 
change the properties of a linked object, and break the link. To edit 
the object, choose the Edit button. To play the object, choose the 
Activate button. "Activate" is a generic term OLE uses to specify a 
verb other than edit. To associate the linked object with another file, 
choose the Change Link button. A dialog box lets you select a new file 
created by SRVRDEMO. You can also choose the appropriate option buttons 
in the Links dialog box to change update options.

Working with linked objects
---------------------------

To see the SRVRDEMO linked objects in action, insert a linked SRVRDEMO 
object into CLIDEMO as described above. Edit the SRVRDEMO linked object 
and position the windows for CLIDEMO and SRVRDEMO so you can see both 
on the screen at the same time. In SRVRDEMO, change the color of the 
object from the Color menu. Notice that the object also changes color 
immediately in CLIDEMO. In SRVRDEMO, choose the File Save command, and
then choose the File Exit command. 

In CLIDEMO, choose the Edit Links command. Next to Update, choose the 
Manual option button and click OK. Edit the linked object again and 
reposition the window so that CLIDEMO and SRVRDEMO are both visible 
on the screen. Change the color of the object again. Notice that the 
object does not change color in CLIDEMO but does change color in 
SRVRDEMO. In SRVRDEMO, save the file and exit. 

Use the Links command again to display the Links dialog. Choose the 
Update Now button. The linked object in CLIDEMO now changes color to 
match SRVRDEMO. As this exercise demonstrates, automatic links update 
an object without user intervention, whereas manual links must be updated 
explicitly by the user.

Using a template to insert an object
------------------------------------

To use a template, choose the Insert Template command from CLIDEMO. 
A dialog box lets you select the template file. The template file 
extension is used to locate the class and server for the file in the 
registration database. The file is loaded into the server application as a 
modifiable object. When you close the server, CLIDEMO prompts you to save 
file changes. If you respond Yes, the updated object is inserted into the 
client document. Note that the template file is not modified. This 
functionality allows you to use a base object with slight modifications 
in different areas of a document or in different applications.

For more information, see the Microsoft(R) Windows(TM) version 3.1 
Software Development Kit (SDK) "Programmer's Reference, Volume 1: 
Overview" manual.
