Home | Overview | How Do I | Sample | Tutorial
Depending on your application, there are four possible implementation strategies for adding OLE support:
This situation usually requires the least work. You simply run AppWizard and select OLE options to create a skeleton application. For information on the OLE options in AppWizard and what they do, see the article The MFC AppWizard (EXE version): Step-by-Step.
Create a new application with AppWizard as above, then copy and paste the code from the new application into your existing application. This will work for servers, containers, or automated applications. See the MFC Tutorial sample, SCRIBBLE, Step 7, and the Scribble Step 7 tutorial for an example of this strategy.
See MFC Technical Note 41 for this conversion strategy.
This situation requires the most work. One approach is to create a new application, as in the first strategy, then copy and paste your existing code into it. If your existing code is written in C, you may need to modify it so it can compile as C++ code. If your C code calls the Windows API, you do not have to change it to use the Microsoft Foundation classes. This approach likely will require some restructuring of your program to support the document/view architecture used by versions 2.0 and higher of the Microsoft Foundation classes. For more information on this architecture, see Technical Note 25, and see the MFC Migration Kit, which contains the MFC Migration Guide.
Once you have decided on a strategy, you should either read the Containers or Servers family of articles (depending on the type of application you are writing), or examine the sample programs, or both. The MFC OLE samples OCLIENT and HIERSVR show how to implement the various aspects of containers and servers, respectively. At various points throughout these articles, you will be referred to certain functions in these samples as examples of the techniques being discussed.
See Also Containers: Implementing a Container, Servers: Implementing a Server, The MFC AppWizard (EXE version): Step-by-Step