I have a MFC regular DLL project that worked fine under Visual Studio 2008, but when the project was upgraded to VS 2010, a new problem came up where the following assertion would fail in appcore.cpp:
CWinApp::CWinApp(LPCTSTR lpszAppName)
{
[...]
ASSERT(AfxGetThread() == NULL);
The assertion would fail when more than one instance of the CDialog derived class was created. From the research I have done on the web, it seems there is change in the behavior of MFC which would cause this failure.
From what I have read, the workaround to this problem is to create each CDialog derived class in a new CWinThread, but I'm getting the same problem, so, I'm sure there is something missing in my implementation, however, I don't know what is missing.
An example I used to attempt to create a CDialog within a CWinThread class came from http://www.experts-exchange.com/Programming/System/Windows__Programming/A_1886-Create-a-Dialog-in-its-Own-Thread.html , however my code is still failing at the same above listed ASSERT.
So my question is, does anyone have a good example, with source, on how to properly create multiple CDialog derived classes, using CWinThread, in a MFC regular DLL?
Oh, and if my understanding of creating multiple threads to solve the above listed ASSERT is wrong, please tell me why.
CWinApp
objects? – IInspectableAfxGetThread()
returnsNULL
. – IInspectable