Moving Your Code into the MFC Project

Before any real conversion begins, you need to get your source code set up as part of your new MFC project and do some limited cleanup work. Here are the general steps in brief (details follow):

1. Copy source files from your C project into the MFC project directory.

Caution See the following discussion in Copying C Files to the MFC Project for some files you should not copy over.

2. Rename the .C files to .CPP and formally add them to the project.

3. Merge your C project's .RC file with the one in the MFC project. The discussion below explains how to do this.

4. Trim unnecessary #include directives in your files, replacing them with:


#include <stdafx.h>

When you finish these steps, you've completed the preparation. Your files and resources are merged with the MFC skeleton application but not yet integrated with it. Building the project now will result in numerous errors. Phase 1 begins the migration in earnest and corrects those problems. By the end of Phase 1, you will have a running application that does what your C application did and also takes advantage of some of MFC's features.