1.1.3 Server and Client Applications

Throughout most OLE-related documentation, an application is specified as either a client application or a server application, even though an application may function as either at different times. The word processor mentioned in the examples of Figures 1 and 4 operates as a client application that obtains service from two different server applications; a graphics program and a spreadsheet program. As a client application, the word processor creates a container document, referred to as such because it contains the embedded and linked objects as well as the text data that it creates itself.

The menus of the client application are modified to include an Object command on the Insert menu that opens an Insert Object dialog box. This dialog box, shown in Figure 5, allows the user to choose the type (or class) of object to be embedded into the container document from a list of object types. The client application creates this list of object types dynamically by polling the registration database. This database is used by all server applications to register the type (class) of object it will serve, the types of objects it supports, and the types of operations it can perform on objects. For more information on registering applications, see the section titled "The System Registration Database," later in this chapter.

The example shown in Figure 5 lists Microsoft Drawing (a class name) as one of the object types available for embedding, indicating that the application named Microsoft Draw can operate as a server application that provides objects to client applications. The objects it provides are metafile-type drawings created with lines, circles, text, and so on.

Figure 5. The Insert Object dialog box lets users choose objects

When the user chooses a particular object type, the corresponding server application starts, which allows the user to create the object, or open a file that contains the object. After editing the object, the user quits the server application and the client application's container document is automatically updated with the embedded object at the current insertion point. Later, to make changes to the object, the user simply double-clicks on the object to start the server application again; a special editing window opens in which the object is placed for revisions.