Home | Overview | How Do I | Sample | Tutorial
This article describes the steps necessary to incorporate optional advanced features into existing container applications. These features are:
A container/server application is an application that acts as both a container and a server. Microsoft Word for Windows is an example of this. You can embed Word for Windows documents in other applications, and you can also embed items in Word for Windows documents. The process for modifying your container application to be both a container and a full-server (you can’t create a combination container/mini-server application) is similar to the process for creating a full-server.
The article Servers: Implementing a Server lists a number of tasks required to implement a server application. If you convert a container application to a container/server application, you’ll need to perform some of those same tasks, adding code to the container. The following lists the important things to consider:
For example: the MFC OLE sample OCLIENT has embedded an item created by your container/server application. You open the OCLIENT application and in-place edit the item created by your container/server application. While editing your application’s item, you decide you want to embed an item created by the MFC OLE sample HIERSVR. To do this, you cannot use in-place activation. You must fully open HIERSVR to activate this item. Because the Microsoft Foundation Class Library does not support this OLE feature, overriding COleClientItem::CanActivate allows you to check for this situation and prevent a possible run-time error in your application.
If you are creating a new application and want it to function as a container/server application, choose that option in the OLE Options dialog box in AppWizard and this support will be created automatically. For more information, see the article Overview: Creating an ActiveX Control Container. For information about MFC samples, see MFC Samples.
Note that you cannot insert an MDI application into itself. An application that is a container/server cannot be inserted into itself unless it is an SDI application.
The Links to Embedded Objects feature enables a user to create a document with an OLE link to an embedded object inside your container application. For example, create a document in a word processor containing an embedded spreadsheet. If your application supports links to embedded objects, it could paste a link to the spreadsheet contained in the word processor’s document. This feature allows your application to use the information contained in the spreadsheet without knowing where the word processor originally got it.
To link to embedded objects in your application
If the application is launched with the “/Embedded” switch, it should not show its main window, similar to a server application.
The MFC OLE sample OCLIENT implements this feature. For an example of how this is done, see the InitInstance function in the OCLIENT.CPP file of this sample application.
See Also Servers