// MFC_DLL.h : main header file for the MFC_DLL DLL
#error "include 'stdafx.h' before including this file for PCH"
#include "resource.h" // main symbols
#define EXPORTED __declspec(dllimport)
#define EXPORTED __declspec(dllexport)
// See MFC_DLL.cpp for the implementation of this class
class EXPORTED CMFC_DLLApp : public CWinApp
virtual BOOL InitInstance();
if (lpszAppName != NULL)
m_pszAppName = _tcsdup(lpszAppName);
m_pszAppName = NULL;
// initialize CWinThread state
AFX_MODULE_STATE* pModuleState = _AFX_CMDTARGET_GETSTATE();
AFX_MODULE_THREAD_STATE* pThreadState = pModuleState->m_thread;
ASSERT(AfxGetThread() == NULL); <<<<-----Assert here
I created a <label for="DLL_TYPE_REGULAR" id="DLL_TYPE_REGULAR_LABEL">Regular
DLL using shared MFC DLL</label> called CMFC_DLLApp. I then built an MFC form that has a button to instantiate the class and use it. When I instantiate the class, it asserted in CWinApp
constructor. A couple questions:
1. What am I doing wrong that caused the Assert?
2. Why is the DLL being inherited from CWinApp? I just want an MFC class DLL that contains a bunch of simple routines that has nothing to do with GUI. As simple as Max(), Min()..that kind of stuff. Is there anyway to do that?
3. In order to use MFC DLL, does that mean I need to build a GUI interface around it?
I am using Visual Studio 2012
Edited byMax21226Wednesday, September 04, 2013 9:02 PM