mfc程序流程

发表于:2007-07-01来源:作者:点击数: 标签:
1: application object产生 2:AfxWinMain执行AfxWininit,调用AfxinitThred 3:AfxWinMain执行InitApplication,Initinstance(是Cwinapp虚涵数, 改写!) 4:CMyWinApp::InitInstance new一个CMyFrameWnd 5:CMyFrameWnd构造函数调用Create产生主窗口 6:InitIn

     

   1: application object产生

   2:AfxWinMain执行AfxWininit,调用AfxinitThred

   3:AfxWinMain执行InitApplication,Initinstance(是Cwinapp虚涵数, 改写!)

  4:CMyWinApp::InitInstance   new 一个CMyFrameWnd

  5:CMyFrameWnd构造函数调用Create产生主窗口

  6:InitInstance 执行ShowWindow,UpdateWindow,发出WM_PAINT

  7:AfxWinMain 执行run 

 8:::GetMessage,WM_PAINT 由::DispatchMessage送CWnd::DefWindowProc-->MessageMap

  9:调用对应函数(BEGIN—MESSAGE—MAP,END_MESSAGE_MAP建立的)

 10:单击file/close,则发出WM—CLOSE

 11:CMyFrameWnd交默认处理

 12:调用::DestroyWindow发出WM_DESTROY

 13:默认处理调用::postQuitMessage 发出WM_QUIT

  14:CWinapp::Run收到WM—QUIT结束内部循环,调用ExitInsance(若CMyWinApp改写

Exitinstance,则调用CMyWinApp::ExitInstance;

  15:回到AfxWinMain,执行AfxWinTerm,程序结束!!

 

 

 

 


原文转自:http://www.ltesting.net