基类CWinApp的构造里有设置:
pModuleState->m_pCurrentWinApp = this;
然后AfxGetApp可以获得这个结构,从里面拿出m_pCurrentWinApp
_AFXWIN_INLINE CWinApp* AFXAPI AfxGetApp() { return afxCurrentWinApp; }
#define afxCurrentWinApp AfxGetModuleState()->m_pCurrentWinApp