HOWTO: Remove OLE Controls & Gallery Components from a Project

Last reviewed: October 7, 1997
Article ID: Q142318
The information in this article applies to:
  • The development environment included with: - Microsoft Visual C++, 32-bit Edition, versions 4.0, 4.1, 4.2, 5.0

SUMMARY

There are occasions when you may need to remove an OLE Control or Component Gallery component from your project. Because all components are different, the steps in this are general guidelines only.

MORE INFORMATION

Step-by-Step Prodder

  1. If you are attempting to remove a Component Gallery component from your project, read the Results section of the component's Help file to find out what the component inserts into your application. If you are attempting to remove an OLE Control from your project, locate the wrapper classes for the OLE Control that have been inserted into your project.

  2. Remove the source code files that were inserted into your project. Generally, these are source files that define the class and relevant code for the OLE Control or Component. For example, the Password Dialog Component creates and adds the PWDLG1.CPP and PWDLG1.H files to your project.

  3. If you are attempting to remove a Component Gallery component, remove any code that is inserted into existing code files. For example, several Components insert code into a project's InitInstance() function. To find all occurrences of inserted code, search for "// CG:" in your .cpp files. This comment precedes each code insertion that was made to your application. Also, be sure to remove any added member declarations in the .h files, and make sure your remove all appropriate header files from these same source files. For example, to remove the Password Dialog Component from your project, remove the following from all files in your project:

          #include "pwdlg1.h"
    

    When you remove code, be sure to remove any associated message map entries. For example, the Clipboard Assistant Component adds a number of message map entries to a project.

  4. Remove any added resources. For example, the Password Dialog Component inserts a dialog resource into the project's resource file (.rc).

In addition to the previous steps, some OLE Controls and Component Gallery components insert data at the end of your project's .mak file for VC 4.x and .dsp file for VC 5.0. This data will not affect your project but may prevent you from reinserting the Control or Component later. Developer Studio uses this data to determine which controls to display in its Controls toolbar. This data can be identified by the Section keyword. For example, inserting the Splash Screen Component adds the following text to your project's .mak or .dsp file:

   #####################################################################
   # Section SplashIt : {21FFBCBF-33A6-11CF-9420-00AA00C14AF9}
   #   0:8:Splash.h:C:\SplashIt\Splash.h
   #   0:10:Splash.cpp:C:\SpashIt\Splash.cpp
   #   1:10:IDB_SPLASH:102
   #   2:10:ResHdrName:resource.h
   #   2:11:ProjHdrName:stdafx.h
   #   2:10:WrapperDef:_SPLASH_SCRN_
   #   2:12:SplClassName:CSplashWnd
   #   2:21:SplashScreenInsertKey:4.0
   #   2:10:HeaderName:Splash.h
   #   2:10:ImplemName:Splash.cpp
   #   2:7:BmpID16:IDB_SPLASH
   # End Section
   #####################################################################

To allow for re-inserting the Splash Screen Component, this section of text must first be removed from the project's .mak or .dsp file.

WARNING: Remove only the entries for the component you want to delete. Do not delete another component's entry that you may still need to keep.

To determine which Section entries belong to a particular component, you should create a new MFC project, insert the component in question, and examine this new project's .mak or .dsp file. Then you can remove the identical Section entries from the original project.

Keywords          : VwbIss
Version           : WINNT:4.0,4.1,4.2,5.0;
Platform          : NT WINDOWS
Issue type        : kbhowto


================================================================================


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: October 7, 1997
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.