Share via


Upgrade Previous 16-Bit Versions of Visual C++

OverviewHow Do IFAQDetails

Projects built in previous 16-bit versions of Visual C++ can be opened and saved in Visual C++ projects automatically.

However, if you have built a 16-bit Visual C++ project from the command line with your own makefile, the development environment does not recognize project data in your file. Instead, the development environment offers to wrap your makefile. If you choose this option, a project is created with one file in it, your makefile, but the project will still build and run within the development environment, assuming it is 32-bit compatible. See port a project made with NMAKE to the development environment or port a project made without NMAKE to the development environment for step-by-step instructions.  To take advantage of wizards and integrated debugging features, it would be better for you to create a new project in the development environment, add your existing files to it, then build and save it as an up-to-date project.

To convert projects built in 16-bit Visual C++ to development environment projects

  1. From the File menu, click Open Workspace.

    The Open Project Workspace dialog box appears.

  2. In the Files of Type drop-down list, select All Files (*.*) to display all files.

  3. Select the drive and directory containing the previous makefile.

  4. Select the makefile from the list and click Open.

    A message box is displayed saying that the project will be converted, that project settings will be converted to Win32 equivalents, and asking if you want to convert.

  5. Click Yes.

    A new project workspace file (.DWS) is created with your old makefile name, then written to the same directory as your existing makefile. For example, if your previous project was MYAPP.MAK, then MYAPP.DSW is created and saved to the same directory.

    After the new files are written, the new project workspace opens in the development environment.

To add your 16-bit Visual C++ files to a Visual C++ project

  1. Open the 16-bit project in the development environment as described in the previous procedure.

  2. From the Project menu, click Add ToProject., then click Files from the submenu that appears.

  3. In the Insert Files into Project dialog box, select all your application files and click OK.

    Your application files are now in the Visual C++ development environment project.

To upgrade 16-bit Visual C++ code

  1. Remove VBX controls.

    VBX controls are not supported in a 32-bit application. The CVBControl class, the AfxRegisterVBEvent, AfxGetPict, AfxSetPict, and AfxReferencePict global functions, and the ON_VBXEVENT macro are unavailable with Win32. If you use VBX controls in your application, you must replace them with standard Windows controls or COM controls, redesigning your application as necessary.

  2. Replace difficult-to-port code, such as assembly-language functions and MS-DOS calls, with stubs.

    If your 16-bit application makes calls to an assembly-language module, you should rewrite it in C or C++ if possible. Otherwise, you will be faced with rewriting the assembly-language portion for each hardware platform that can run Win32.

    If you’ve used any MS-DOS services for file I/O, including those used by Windows version 3.x, you will have to rewrite the code using the Win32 file I/O set. If you’ve used the class for file I/O, you are shielded from this change because CFile uses the new function calls even though its member function interface remains unchanged.

  3. Build your application with and note any 32-bit related problems.

  4. Use the information in Porting 16-Bit Code to 32-Bit Windows. Rebuild until the main body of your program is running correctly.

  5. Implement each function that you replaced with a stub in step 2 until the entire application runs correctly.

  6. Remove MFC libraries from the link input list.

    Let the MFC header files automatically link in the correct version of MFC.

You may want or need to modify the new project: