HOWTO: Upgrade Project to use the New MSCCOMCTL.OCX in VB6
Visual Basic Developers Resource Centre

Last reviewed: August 7, 1998
Article ID: Q190952


The information in this article applies to:
  • Microsoft Visual Basic Learning, Professional, and Enterprise Editions for Windows, version 6.0

SUMMARY

The following controls are not automatically updated when a Visual Basic 5.0 project is loaded by Visual Basic 6.0.

COMCLTL32.OCX, COMCT232.OCX, and MSCHART.OCX

The project must be manually upgraded to the new Visual Basic 6.0 controls: MSCOMCTL.OCX, MSCOMCT2.OCX, and MSCHRT20.OCX, respectively.

MORE INFORMATION

The new controls are not backward compatible with the older versions and, in accordance with the rules of COM, were given new file names and new GUIDs. This prevents your application from breaking existing applications that use the older controls. Because the new controls have new names and GUIDs, they also have new Typelibs. When you load a Visual Basic project, it checks the Typelib version. However, Visual Basic does not know the Controls were updated because the Typelib for the new controls have a different GUID than the Typelib for the old controls.

To upgrade a project to the newer version, you must do the following:

  • Open the VBP file in a text editor, such as Notepad, and change the line(s) that reference the old version of the OCX to the following:

    Object={831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0; MSCOMCTL.OCX

    Object={86CF1D34-0C5F-11D2-A9FC-0000F8754DA1}#2.0#0; MSCOMCT2.OCX

    Object={65E121D4-0C60-11D2-A9FC-0000F8754DA1}#2.0#0; MSCHRT20.OCX

    Save and close the VBP file.

  • Open any FRM file (or CTL file) that uses one of the above controls in a text editor, and change the line(s) that reference the old version of the OCX to the following:

    Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCTL.OCX"

    Object = "{86CF1D34-0C5F-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCT2.OCX"

    Object = "{65E121D4-0C60-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCHRT20.OCX"

  • Change all text that references the old libraries to the new library names. This means that you need to replace ComCtlLib, Comctl2, and MSChartLib with MSComCtlLib, MSComCtl2, and MSChart20Lib. For example, change:
          ComctlLib.ImageList
    to:  MSComctlLib.ImageList
  • Save and close the file. When you open the project in Visual Basic 6.0, it will use the new MSCOMCTL.OCX, MSCOMCT2.OCX and/or MSCHRT20.OCX controls.

NOTE:

  • IMPORTANT: Before you edit your VBP, FRM, or CTL files, you should backup all of the files in your project.
      
  • While the objects listed in step 1 and 2 are very similar, they are not identical and the upgrade will not work properly if each is not copied exactly to the correct file.
      
  • If you get a message stating that the header is corrupt when you attempt to load the project, you have probably made a copy error. Please go to your backup and repeat the process.
      
  • If you prefer to continue using the older versions of these controls, comctl32.ocx and comct232.ocx are included on the Visual Basic 6.0 product CD-ROM in the \OS\System directory. Mschart32.ocx resides in the \Common\Tools\VB\Controls directory.

© 1998 Microsoft Corporation. All rights reserved.
Logo and information copyright © Microsoft Corporation 1999

 

 
 

PayPal Link
Make payments with PayPal - it's fast, free and secure!

 
 
 
 

Copyright ©1996-2008 VBnet and Randy Birch. All Rights Reserved.
Terms of Use  |  Your Privacy