获取窗口指针

1.获取工具条指针,工具条有一特殊标识(AFX_IDW_TOOLBAR)

    CToolBar *pTool = (CToolBar*)AfxGetMainWnd()->GetDescendantWindow(特殊标识);

2.获取状态条指针

    (CStatusBar*)AfxGetMainWnd()->GetDescendantWindow(AFX_IDW_STATUS_BAR);

3.获取主窗口指针:

    CMainFrame *pFrame = (CMainFrame*)(AfxGetApp()->m_pMainWnd);

4.获取视类指针:

     CMyView *pView= CMyView*)((CMainFrame*)AfxGetApp()->m_pMainWnd)->GetActiveView();

  或     CMyView *pView=(CMyView*)GetActiveView();

你可能感兴趣的:(获取窗口指针)