zoukankan      html  css  js  c++  java
  • c++SDI的启动和关闭的调试跟踪的过程摘抄

    1 Create
    WinMainCRTStartup()--crtexe.c
    1__tmainCRTStartup()--crtexe.c
    1.1_tWinMain()--appmodul.cpp
    1.1.1 AfxWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,__in LPTSTR lpCmdLine, int nCmdShow)--winmain.cpp
    1.1.1.1 CWinApp* AFXAPI AfxGetApp(){ return afxCurrentWinApp; }
    1.1.1.2 CWinApp::InitApplication()
    1.1.1.3 CWinApp::InitInstance()<-->用户一般重载
    1.1.1.3.1 CWinApp::ProcessShellCommand(CCommandLineInfo& rCmdInfo)
    1.1.1.3.1.1 AfxGetApp()->OnCmdMsg(ID_FILE_NEW, 0, NULL, NULL)
    1.1.1.3.1.1.1 CCmdTarget::OnCmdMsg(unsigned int nID=57600, int nCode=0, void * pExtra=0x00000000, AFX_CMDHANDLERINFO * pHandlerInfo=0x00000000)--cmdtarg.cpp
    1.1.1.3.1.1.1.1 从消息映射中找到对应消息处理过程
    1.1.1.3.1.1.1.2 AfxDispatchCmdMsg(this, nID, nCode,lpEntry->pfn, pExtra, lpEntry->nSig, pHandlerInfo)--cmdtarg.cpp
    1.1.1.3.1.1.1.2.1 进行消息类型判断,采用合适的参数调用处理函数
    1.1.1.3.1.1.1.2.2 CWinApp::OnFileNew()
    1.1.1.3.1.1.1.2.2.1 m_pDocManager->OnFileNew()<==>void CDocManager::OnFileNew()
    1.1.1.3.1.1.1.2.2.1.1 pTemplate->OpenDocumentFile(NULL);<==>CDocument* CSingleDocTemplate::OpenDocumentFile()
    1.1.1.3.1.1.1.2.2.1.1.1 pFrame = CreateNewFrame(pDocument, NULL)<==>CFrameWnd* CDocTemplate::CreateNewFrame()
    1.1.1.3.1.1.1.2.2.1.1.1.1 pFrame->LoadFrame(m_nIDResource,WS_OVERLAPPEDWINDOW | FWS_ADDTOTITLE,NULL, &context)<==>CFrameWnd::LoadFrame()
    1.1.1.3.1.1.1.2.2.1.1.1.1.1 CFrameWnd::Create()
    1.1.1.3.1.1.1.2.2.1.1.1.1.1.1 CWnd::CreateEx()
    1.1.1.3.1.1.1.2.2.1.1.1.1.1.1.1 PreCreateWindow()
    1.1.1.3.1.1.1.2.2.1.1.1.1.1.1.2 ::CreateWindowExA()<--->API
    1.1.1.3.1.1.1.2.2.1.1.1.1.1.1.2.1 AfxWndProcBase()
    1.1.1.3.1.1.1.2.2.1.1.1.1.1.1.2.1.1 CWnd::WindowProc
    1.1.1.3.1.1.1.2.2.1.1.1.1.1.1.2.1.1.1 CWnd::OnWndMsg(UINT message, WPARAM wParam, LPARAM lParam, LRESULT* pResult)
    1.1.1.3.1.1.1.2.2.1.1.1.1.1.1.2.1.1.1.1 从消息映射中找到对应消息处理过程
    1.1.1.3.1.1.1.2.2.1.1.1.1.1.1.2.1.1.1.2 CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
    1.1.1.3.1.1.1.2.2.1.1.1.1.1.1.2.1.1.1.2.1 CFrameWnd::OnCreate(LPCREATESTRUCT lpCreateStruct)
    1.1.1.3.1.1.1.2.2.1.1.1.1.1.1.2.1.1.1.2.1.1 CFrameWnd::OnCreateHelper(LPCREATESTRUCT lpcs, CCreateContext* pContext)
    1.1.1.3.1.1.1.2.2.1.1.1.1.1.1.2.1.1.1.2.1.1.1 CWnd::OnCreate()
    1.1.1.3.1.1.1.2.2.1.1.1.1.1.1.2.1.1.1.2.1.1.1.1 CWnd::DefWindowProc(UINT nMsg, WPARAM wParam, LPARAM lParam)

    1.1.1.3.1.1.1.2.2.1.1.1.1.1.1.2.1.1.1.2.1.1.2 调用默认的或者用户自己重载该函数用于创建特定的视图
    1.1.1.3.1.1.1.2.2.1.1.1.1.1.1.2.1.1.1.2.1.1.3 默认的:CFrameWnd::OnCreateClient(LPCREATESTRUCT lpcs, CCreateContext* pContext)
    1.1.1.3.1.1.1.2.2.1.1.1.1.1.1.2.1.1.1.2.1.1.3.1 CWnd* CFrameWnd::CreateView(CCreateContext* pContext, UINT nID)

    1.1.1.3.1.1.1.2.2.1.1.1.1.1.1.2.1.1.1.2.1.1.5 用户自定义:CMainFrame::OnCreateClient(LPCREATESTRUCT lpcs, CCreateContext* pContext)

    1.1.1.3.1.1.1.2.2.1.1.1.1.1.1.2.1.1.1.2.1.1.6 CWnd::PostMessage(WM_SETMESSAGESTRING, AFX_IDS_IDLEMESSAGE);
    1.1.1.3.1.1.1.2.2.1.1.1.1.1.1.2.1.1.1.2.1.1.7 CFrameWnd::RecalcLayout()
    1.1.1.3.1.1.1.2.2.1.1.1.1.1.1.2.1.1.1.2.1.1.7.1 CWnd::RepositionBars
    1.1.1.3.1.1.1.2.2.1.1.1.1.1.1.2.1.1.1.2.2 用户一般重载,创建工具条之类(这时视图和主窗口之类都已经创建)
    1.1.1.3.1.1.1.2.2.1.1.1.1.2 CFrameWnd::LoadAccelTable(LPCTSTR lpszResourceName)
    1.1.1.3.1.1.1.2.2.1.1.2 pDocument->OnNewDocument()<-->一般用户覆盖此处理
    1.1.1.3.1.1.1.2.2.1.1.2.1 BOOL CDocument::OnNewDocument()
    1.1.1.3.1.1.1.2.2.1.1.2.2 添加自己的代码进行文档相关处理
    1.1.1.3.1.1.1.2.2.1.1.3 pThread->m_pMainWnd = pFrame(设置主窗口)
    1.1.1.3.1.1.1.2.2.1.1.4 CDocTemplate::InitialUpdateFrame(CFrameWnd* pFrame, CDocument* pDoc,BOOL bMakeVisible)
    1.1.1.3.1.1.1.2.2.1.1.4.1 SendMessageToDescendants(WM_INITIALUPDATE, 0, 0, TRUE, TRUE)
    1.1.1.3.1.1.1.2.2.1.1.4.1.1 CXXXXView::OnInitialUpdate()

    1.1.1.3.1.1.1.2.2.1.1.4.2 void CFrameWnd::SetActiveView(CView* pViewNew, BOOL bNotify)
    1.1.1.3 CWinApp::Run();--appcore.cpp
    1.1.1.3.1 CWinThread::Run()--thrdcore.cpp

    2、Destroy
    void CFrameWnd::OnClose()<-->winmfrm.cpp
      1 CDocument* pDocument = GetActiveDocument();
      2 pDocument->CanCloseFrame(this)
      2.1 BOOL CDocument::SaveModified()
      2.1.1判断文档是否别修改
      2.1.2CDocument::DoFileSave
      3 void CWinApp::CloseAllDocuments(BOOL bEndSession)
      3.1 m_pDocManager->CloseAllDocuments(bEndSession);
      3.1.1pTemplate->CloseAllDocuments(bEndSession);
      3.1.1.1 CDocument::OnCloseDocument()
      3.1.1.1.1 pFrame->DestroyWindow();<-->CWnd::DestroyWindow()
      3.1.1.1.1::DestroyWindow(m_hWnd)--API函数
      3.1.1.1.1.1进入消息处理
      3.1.1.1.1.2CFrameWnd::OnDestroy()
      3.1.1.1.1.2.1DestroyDockBars();
      3.1.1.1.1.2.2CWnd::OnDestroy();
      4 AfxPostQuitMessage(0);

  • 相关阅读:
    Java学习:面向对象三大特征:封装、继承、多态之封装性
    Java学习:构造方法
    Java学习:集合双列Map
    斗地主综合案例:有序版本(双列)
    JDK9对集合添加的优化
    Java学习:Debug调试程序
    计算一个字符串中每一个字符出现的次数
    Java学习:Map接口
    Java学习:可变参数
    Pediy CTF 2018 reverse
  • 原文地址:https://www.cnblogs.com/xiaomaohai/p/6157186.html
Copyright © 2011-2022 走看看