MFC Question : (From where AFxWinMain gets CwinApp object) [modified]
-
Dear all, Anybody knows from where AfxWinMain gets the CWinApp global object pointer ? When i looked the MFC source file (winmain.cpp) i can see the following lines. nt AFXAPI AfxWinMain(..../*params*/) { int nReturnCode = -1; CWinThread* pThread = AfxGetThread(); CWinApp* pApp = AfxGetApp(); } Surely AfxGetApp() returns that global object. me again looked the AfxGetApp function , it is calling a AfxGetModuleState state function and this function returns the CWinApp object. AfxGetModuleState gets this value from CThreadLocal class's object. My question is How MFC getting the pointer of my CWinApp derived class object. Share your ideas please.. -- modified at 0:51 Friday 5th January, 2007
If u can Dream... U can do it
-
Dear all, Anybody knows from where AfxWinMain gets the CWinApp global object pointer ? When i looked the MFC source file (winmain.cpp) i can see the following lines. nt AFXAPI AfxWinMain(..../*params*/) { int nReturnCode = -1; CWinThread* pThread = AfxGetThread(); CWinApp* pApp = AfxGetApp(); } Surely AfxGetApp() returns that global object. me again looked the AfxGetApp function , it is calling a AfxGetModuleState state function and this function returns the CWinApp object. AfxGetModuleState gets this value from CThreadLocal class's object. My question is How MFC getting the pointer of my CWinApp derived class object. Share your ideas please.. -- modified at 0:51 Friday 5th January, 2007
If u can Dream... U can do it
The following line is from
CWinApp::CWinApp
:pModuleState->m_pCurrentWinApp = this;
That's how it gets the app.Steve
-
The following line is from
CWinApp::CWinApp
:pModuleState->m_pCurrentWinApp = this;
That's how it gets the app.Steve