In a Windows console application, Ken would like to use some MFC classes, such as CStringArray, to add support for MFC with the following two simple settings:
1. Right-click Project name, References Select all Configuration
- Configuration Properties->general->use of MFC->use MFC in a Shared DLL
2. Add the contents to the StdAfx.h header file:
#define _atl_cstring_explicit_constructors//Some CSTRING constructors'll be EXPLICIT
#ifndef Vc_extralean
#define VC_EXTRALEAN//Exclude rarely-used stuff from Windows headers
#endif
#include <afx.h>
#include <afxwin.h>//MFC core and standard components
#include <afxext.h>//MFC extensions
#ifndef _afx_no_ole_support
#include <afxdtctl.h>//MFC support for Internet Explorer 4 Common Controls
#endif
#ifndef _afx_no_afxcmn_support
#include <afxcmn.h>//MFC support for Windows Common Controls
#endif//_afx_no_afxcmn_support
Add support for MFC in console applications