出一道小题目: :)

解决方案 »

  1.   

    CMainFrame* pMF=(CMainFrame*)AfxGetApp()->GetMainWnd();

    CMainFrame* pMF=(CMainFrame*)AfxGetApp()->m_pMainWnd;
    一样吗?大家来说说!
      

  2.   

    我认为GetMainWnd()就是通过函数得到m_pMainWnd。
      

  3.   

    还可以
    CMainFrame* pMF=(CMainFrame*)AfxGetMainWnd();
      

  4.   

    CWinThread::GetMainWnd
    virtual CWnd * GetMainWnd( );Return ValueThis function returns a pointer to one of two types of windows. If your thread is part of an OLE server and has an object that is in-place active inside an active container, this function returns the CWinApp::m_pActiveWnd data member of the CWinThread object. If there is no object that is in-place active within a container or your application is not an OLE server, this function returns the m_pMainWnd data member of your thread object.
      

  5.   

    一样的
    其实
    GetMainWnd()
    {
       return m_pMainWnd;
    }
      

  6.   

    一样的
    其实
    GetMainWnd()
    {
       return m_pMainWnd;
    }
      

  7.   

    This function returns a pointer to one of two types of windows. If your thread is part of an OLE server and has an object that is in-place active inside an active container, this function returns the CWinApp::m_pActiveWnd data member of the CWinThread object. If there is no object that is in-place active within a container or your application is not an OLE server, this function returns the m_pMainWnd data member of your thread object.
    由此看来不同啊,只是在If there is no object that is in-place active within a container or your application is not an OLE server时是一样的!!
      

  8.   

    不太一样。看MSDN后觉得。
    因为:
    使用GetMainWnd(),那么返回的值是:
    This function returns a pointer to one of two types 
    of windows. 
    表示有2种情况。情况一:
    If your thread is part of an OLE server 
    and has an object that is in-place active inside an 
    active container, this function returns the 
    CWinApp::m_pActiveWnd data member of the CWinThread object. 我有一点不明白:
    这个CWinApp::m_pActiveWnd怎么是data member of the CWinThread object?
    CWinApp::m_pActiveWnd不是应该是data member of the CWinApp object。
    虽然CWinThread也有CWinThread::m_pActiveWnd。
    但“CWinApp::m_pActiveWnd data member of the CWinThread object”这句话
    是不是有点不太合适呢?还是我理解有偏差?情况二:
    If there is no object that is in-place active within 
    a container or your application is not an OLE server, 
    this function returns the m_pMainWnd data member of your thread object.可见2个还是有差别的。
      

  9.   

    CWinThread::GetMainWnd
    virtual CWnd * GetMainWnd( );Return ValueThis function returns a pointer to one of two types of windows. If your thread is part of an OLE server and has an object that is in-place active inside an active container, this function returns the CWinApp::m_pActiveWnd data member of the CWinThread object. If there is no object that is in-place active within a container or your application is not an OLE server, this function returns the m_pMainWnd data member of your thread object
      

  10.   

    有些人还是仔细看过,和考虑过的。(不过还是有人草率的回答“一样”)不过没人说的很透彻呀。
    (还有人想混,照贴MSDN,我也有!)我要的是透彻些的理解!前面的几位高人,再给解释清楚些吧,谢谢