Creating an OLE Server

Scribble: OLE Server Application, Lesson 1

Tip   If you prefer working from a printed tutorial, see Copying and Printing in MSDN Library Help for details about printing a lesson, a set of topics, or a single topic.

Suggested Reading in the Win32 SDK

An OLE in-place editing server application can create OLE items that can be embedded or linked into container applications. Some server applications support only the creation of embedded items, while others support the creation of both embedded and linked items.

A container application must be able to start a server application when the user wants to edit an item. If a server application supports linked items, it must also be able to copy its data to the Clipboard so that a container can use that data to create OLE items.

An application can be both a container and a server; that is, it can both incorporate external data into its documents and create data that can be incorporated as items into the documents of other applications.

Scribble Step 7 addresses two general cases for adding OLE server support to an application:

The technique described in this lesson illustrates both cases, even though the tutorial starts with an existing MFC application, Scribble Step 6, to which you will add OLE server support. For more information on Scribble, see Lessons 1 through 10.

As when adding support for context-sensitive help to Scribble Step 6, you will use AppWizard to provide a starter OLE server application in a scratch directory. Then you will copy files and code fragments from the scratch directory to the existing Scribble code base. By doing this, you will learn about the OLE server code that AppWizard provides. Therefore, even if you are starting a new MFC OLE server application from scratch, you are advised to read this tutorial, if not actually do the steps.

How does this approach differ from the traditional approach of copying source code from a sample application? AppWizard allows you to customize the sample code you will be borrowing. That is, when you create the scratch application, you will name it “Scribble,” give the classes the same names Scribble itself uses, and so on. Thus, when you copy source code from the AppWizard-created sample application, it will match the class names of your original application. You can use this approach to add other AppWizard-supported features to your existing MFC applications “after the fact.”