AfxGetMaiwnd返回值是类型CWnd*,为什么不是CFrameWnd

解决方案 »

  1.   

    CFrameWnd也是派生于Cwnd的吧
    所以返回基类的类型很正常
      

  2.   

    Mainwnd有可能不是CFrameWnd,比如,可能是dialog,或者用户自定义的类型,但一般用到的mfc窗口都是从CWnd派生的。
      

  3.   

    If your application is an OLE server, call this function to retrieve a pointer to the active main window of the application instead of directly referring to the m_pMainWnd member of the application object.