Monday, December 1, 2008

How to add MFC support to a simple ATL project

Step 1:

Add the following:

#define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS

#include afxwin.h

#ifndef _AFX_NO_OLE_SUPPORT

#include afxdisp.h // MFC Automation classes

#endif // _AFX_NO_OLE_SUPPORT

This block should be added before #define _ATL_ALL_WARNINGS

Step 2:

In Configuration properties -> General -> Projects Defaults -> Use of MFC, Select "Use MFC in a Shared DLL"

Step 3:

In the Configuration properties -> C/C++ ->Preprocessor Options section of the Compiler Settings if you are using _USRDLL and _AFXDLL together, try to remove _USRDLL and rebuild again.

We can just add ATL dialog in our project. But there will be some problems such as we can't add Control variables.

No comments: