Every MFC application program has one, and only one, CWinApp derived object. This is the main program's thread, and contains the program's entry point, WinMain(). A call to AfxGetApp() returns a pointer to this object. You should not reference theApp object directly in your program, but use AfxGetApp() instead.
SDK自定义框架下有时也会把很多常规项目中初始化的工作封装成类去完成,这样只要声明一个全局变量theApp就可以了。