求教:MFC的执行流程问题?
本帖最后由 VisualEleven 于 2013-10-30 11:58:25 编辑 看孙鑫教程对MFC流程的说明,我有点不理解.(假设已建了一个test的MFC单文档工程。)
视频教程上说:当程序调用了CWinApp类的构造函数,并执行了CTestApp类的构造函数,且产生了theApp对象之后,接下来就进入WinMain函数。
我的问题是:
1、 怎么知道实例化的对象theApp是WinMain()之前完成的?先后次序是在哪个代码段中控制的?还是由系统控制的?
比如这样的程序流程我可以说对象实例化在main()函数前:
//某.cpp文件
class classname
{
public :
int a ;
classname(){a = 10 ;}
} ;
classname Myclass ;
void Main(.....)
{.....}
#include "stdafx.h"
#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
extern int AFXAPI AfxWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
LPTSTR lpCmdLine, int nCmdShow);
extern "C" int WINAPI
_tWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
LPTSTR lpCmdLine, int nCmdShow)
{
// call shared/exported WinMain
return AfxWinMain(hInstance, hPrevInstance, lpCmdLine, nCmdShow);
}