Phase 1. Migrate Your WinMain and WndProc Code

In Phase 1, you'll follow these steps:

1. Migrate the WinMain Function.

MFC provides its own WinMain, so rescue any special code and delete your WinMain function.

2. Migrate WndProc into a C++ class.

Most of your primary WndProc function maps to the MFC view class. For Phase 1, you'll move the switch statement from WndProc to a view-class member function.

3. Move your WM_PAINT code into a member function.

MFC handles the WM_PAINT message in a special way, mapping it to the view class's OnDraw member function.

4. Move your WM_COMMAND code into a member function.

MFC also handles WM_COMMAND messages in a special way. Normally, the command message for each command ID maps to its own handler function, but for Phase 1, you'll map all WM_COMMAND messages to a single view-class member function.

At this point, you'll have a working MFC application. The purpose of this guide is to help you migrate your code to C++ and MFC as quickly as possible, so your application is not fully integrated with MFC yet. Phases 2 and 3, if you choose to undertake them, will increase the level of integration.