Upgrading a C++ 4.0 Application to Use LEADTOOLS 16

These instructions describe how to upgrade a C++ 4.0 application from LEADTOOLS 12.1 to LEADTOOLS 16. You may also be able to follow these instructions when upgrading from an earlier version.

Note: These instructions have been tested with the LEADTOOLS example programs. Details, such as the names of generated files, could be different in your application.

Upgrading requires the following steps:

1. Install LEADTOOLS 16.

2. Regenerate LEADTOOLS support files.

3. Remove old controls and files.

4. Ensure that the ClassWizard database exists.

5. Replace old controls with new ones.

6. Replace LEADTOOLS files that are included in your project.

7. If necessary, update the LEADTOOLS license string in your application code.

8. Rebuild all files.

The remainder of this topic describes the steps in detail.

1. Install LEADTOOLS 16. Note the following:

By default LEADTOOLS 16 is installed into a different folder than previous versions. If you installed 16 in the same folder as the previous version, the old project (with 12.1 controls) will have some problems if it does not have its own copy of the original L_OCX.H file.

2. Regenerate LEADTOOLS support files. You can do this by creating a new temporary project as follows:

a. Create a new project for the sole purpose of generating the new files. (For step-by-step instructions on creating a simple project, refer to Loading and Displaying an Image.)

b. Add the Lead Control (16) to your project. The LEADTOOLS support files are generated when you add the control.

c. Save and close the project. Later, you will copy the new support files to your old project.

3. Remove old controls and files. Working with the old project, do the following:

a. Delete the LEADTOOLS support files from your old project folder. In the LEADTOOLS examples, these files are named LEAD.CPP, LEAD.H, PICTURE.CPP, and PICTURE.H.

b. To remove the old LEAD control from your project's toolbar, edit your project's MAK file to remove references to the CLead and Picture classes that appear at the end of the file. (In the Microsoft Developer Studio, you can do this by opening the MAK file as a text file.) The references to remove are similar to the following ones:

#########################################################################
# Section mfcdemo : {C30E0AD1-B1BA-11CE-ABC6-F5B2E79D9E3F}
#    2:5:Class:CLead
#    2:10:HeaderFile:lead.h
#    2:8:ImplFile:lead.cpp
# End Section
#########################################################################
#########################################################################
# Section OLE Controls
#    {C30E0AD0-B1BA-11CE-ABC6-F5B2E79D9E3F}
# End Section
#########################################################################
#########################################################################
# Section mfcdemo : {C30E0AD0-B1BA-11CE-ABC6-F5B2E79D9E3F}
#    0:9:Picture.h:E:\Lead62\Examples\Ocx\Mfc40\Demo\Picture.h
#    0:6:Lead.h:E:\Lead62\Examples\Ocx\Mfc40\Demo\Lead.h
#    0:11:Picture.cpp:E:\Lead62\Examples\Ocx\Mfc40\Demo\Picture.cpp
#    0:8:Lead.cpp:E:\Lead62\Examples\Ocx\Mfc40\Demo\Lead.cpp
#    2:21:DefaultSinkHeaderFile:lead.h
#    2:16:DefaultSinkClass:CLead
# End Section
#########################################################################
#########################################################################
# Section mfcdemo : {7BF90981-BF32-101A-8BBB-00AA00300CAB}
#    2:5:Class:CPicture
#    2:10:HeaderFile:picture.h
#    2:8:ImplFile:picture.cpp
# End Section
#########################################################################

c. Save the MAK file; then use the main menu's File > Open Workspace option to open the updated MAK file. (Be sure to open the MAK file, not the MDP file.)

d. Go to the resource editor for your project. Then find and remove all of the LEAD controls from your windows, making note of the control IDs, positions, and properties. (You only need to note properties that are set to non-default values at design time.)

e. Remove the LEAD.CPP and PICTURE.CPP files from your project. You can do this in the Developer Studio's FileView window. The LEAD.H file will remain in the list of dependencies, but that is OK.

4. Ensure that the ClassWizard database exists. To do so, take the following steps:

a. In the Microsoft Developer Studio, press Ctrl-W to go to the MFC Class Wizard. If a message box prompts you to build the ClassWizard database, continue with step 4b. Otherwise, continue with step 4d.

b. Click Yes in the message box. A dialog box appears

c. In the dialog box, click Add All; then click OK. The Class Wizard appears.

d. Click OK to close the Class Wizard.

5. Replace old controls with new ones. To do so, take the following steps:

a. Go to the resource editor.

b. From the main menu, select Insert > Component. (The Component Gallery appears.)

c. Click the OLE Controls tab.

d. Double-click the LEAD Main ActiveX Control (16) icon. (The Confirm Classes dialog box appears.)

e. Ensure that all three classes are checked. Do not change the class names, but if necessary, do change the name of the implementation file to be LEAD.CPP (instead of LEAD1.CPP).

f. Click OK to complete the selection; then click Close to close the Component Gallery. (The LEAD icon appears in the Controls toolbar.)

g. Use the new LEAD control tool to recreate the controls that you deleted earlier.

6. Replace LEADTOOLS files that are included in your project. To do so, take the following steps:

a. Copy the following files to your project folder from the small project that you created earlier: LEAD.CPP, LEAD.H, PICTURE.CPP, PICTURE.H, FONT.CPP, and FONT.H.

b. In the Developer Studio's FileView window, look for LEAD1.CPP and PICTURE1.CPP, and delete them if they are listed. (LEAD.CPP, PICTURE.CPP, and FONT.CPP should be listed. You can add them to the project if they are not.)

c. Correct the location of the L_OCX.H file in the list of dependencies. To see the current location, you can click on the file name with the right mouse button, and select Properties from the pop-up menu. Your project needs to reference the new L_OCX.H file, which is in the LEADTOOLS 16 INCLUDE folder. To fix this reference, you can either copy the new file to the current location, or you can search for the #include statement and change the path. (In the LEADTOOLS Mfcdemo project, the #include statement is in the STDAFX.H file.)

7. If necessary, update the LEADTOOLS license string in your application code. If your application uses the Create function to create an instance of the LEAD control at run time, search for the following license string and change the end date to the current license year: "LEADTOOLS OCX Copyright (c) 1990-200[x] LEAD Technologies, Inc."

8. Rebuild all files as follows:

On the main menu select Build > Rebuild All.