CMDIChildWnd* pActiveChild = ((CMainFrame*)AfxGetApp()->GetMainWnd())->MDIGetActive();和
CMainFrame *pFrm = (CMainFrame *)AfxGetApp()->GetMainWnd();
CMyView *pActiveView= (CMyView *)pFrm->GetActiveFrame()->GetActiveView();pActiveChild和pActiveView好像不同。
上面两者调用的区别是?

解决方案 »

  1.   

    区别是:
    Retrieves the current active MDI child window, along with a flag indicating whether the child window is maximized.CMDIChildWnd* MDIGetActive(
       BOOL* pbMaximized = NULL 
    ) const;
    Parameter
    pbMaximized 
    A pointer to a BOOL return value. Set to TRUE on return if the window is maximized; otherwise FALSE. 
    Return Value
    A pointer to the active MDI child windowCall this member function to obtain a pointer to the active multiple document interface (MDI) child window of an MDI frame window.virtual CFrameWnd* GetActiveFrame( );
    Return Value
    A pointer to the active MDI child window. If the application is an SDI application, or the MDI frame window has no active document, the implicit this pointer will be returned.Call this member function to obtain a pointer to the active view (if any) attached to a frame window (CFrameWnd).CView* GetActiveView( ) const;
    Return Value
    A pointer to the current CView. If there is no current view, returns NULL.