Assuming you have Console based application created with MFC support (i.e., you have not chosen MFC support while using New Project Wizard).
In this Tip/Trick, I am not going into detailed steps of how to create a new project and all. I assume you know all these and face a real life problem of adding MFC support to existing applications.
Follow these simple steps and your application will have MFC support.
Here I am using project name as MyApp
and IDE is Visual Studio 2008
- Open your project.
- In Project Menus --> Select MyApp Properties(MyApp -> name of my project)
- In Configuration Properties -> General -> Use of MFC, select Use MFC in a Shared DLL option.
- Add the following line in your stdafx.h file.
#define VC_EXTRALEAN #endif
#include <afxwin.h> // MFC core and standard components
#include <afxext.h> // MFC extensions
#include <afxdtctl.h> // MFC support for Internet Explorer 4 Common Controls
#include <afxcmn.h> // MFC support for Windows Common Controls
Now your application has MFC support, now you can use any MFC Class, Function or Structure.