AfxGetThread and AfxGetApp return NULL on a derived CWinApp inside a DLL

B

bagnjm

Hi,

I have a huge VC6 MFC project that was converted to Visual Studio 2005
beta2. After the conversion, the application crashes because
AfxGetThread() returns NULL and thus fail on pThread->InitInstance()
inside AfxWinMain().

I have a CWinApp derived class (e.g. CBaseWinApp) exported from a DLL.
This derived class is inherited inside the main app (e.g.
CDerivedWinApp : public CBaseApp) and serves as the global app.
instance (e.g. CDerivedWinApp theApp; ).

I can't reproduce the crash in a synthetic test environment.

Does anybody have an idea what's going on? It works perfectly OK in
VC6.
Am I missing some preliminary call to some magic macro such as
AFX_MANAGE_STATE (which doesn't contribute in my case)??
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Running a process 2

Top