471,357 Members | 1,131 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,357 software developers and data experts.

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


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
Am I missing some preliminary call to some magic macro such as
AFX_MANAGE_STATE (which doesn't contribute in my case)??

Jul 31 '05 #1
0 2988

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by zhiqiang | last post: by
12 posts views Thread by David Sobey | last post: by
5 posts views Thread by Dan Trowbridge | last post: by
3 posts views Thread by kikazaru | last post: by
9 posts views Thread by Alexander Widera | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.