Dear friends , I am making my first steps on MFC and I am studying a 
sample application, which is the base skeleton created by the VC++ 
6.0 Ide as you create an MFC WIN32 typical application.
I find in the startup module (AfxWinInit(..), file WinMain.cpp)  a 
call to AfxGetThread (), appearantly made to retrieve the current 
thread's object pointer.
So my question is the following : who is instantiating the current 
thread's object ? is there any block of source code which is 
automatically added by the Ide in a MFC application like this, apart 
from the WinMain.cpp ?

A second question is this . I see this two code lines :

        CWinThread* pThread = AfxGetThread();
        CWinApp* pApp = AfxGetApp();

and then a few rows after :

        nReturnCode = pThread->Run();

This last line, if I understood well, is to supply the application 
with a message pump .
This is the only line where the pThread pointer is used , so another 
question arises :

wasn't it possible to use directly the pApp pointer to the CWinApp 
object to supply a message pump using its Run method  ?
As far as I know CWinApp should inherit the same method from 
CWinThread ...

Thank you



Reply via email to