BadKarma wrote:
if (!AfxWinInit(::GetModuleHandle(NULL), NULL, ::GetCommandLine(), 0))
BadKarma wrote:
Why is this? The CWinApp object theApp is never used. What does it do?
Look up CWinApp constructor and then step into AfxWinInit, you will see that it needs a CWinApp object, see the call AfxGetApp(). AfxGetApp is able to get an application pointer due the following line in the CWinApp constructor. pModuleState->m_pCurrentWinApp = this; Some MFC specific initialization is also done in these functions and stored in thread local storage. This happens in AfxTls.cpp line number 100, comes via AfxClassInit().
Nibu thomas Microsoft MVP for VC++ Code must be written to be read, not by the compiler, but by another human being. Programming Blog: http://nibuthomas.wordpress.com
modified on Thursday, June 12, 2008 8:51 AM