在CMainFrame类.h里定义了很过其他对话框类的对象指针:
          CDlgViewInfo   * m_pVIDlg;
CDlgShowcmd    * m_pSCDlg;
CDlgTip        * m_pDlgTip;
CTopPane       * m_pTopPane;
CAlarmView     * m_pAlarmView;
在.cpp中这样写:
        m_pVIDlg = new CDlgViewInfo(this);     //显示进门员工信息
if(m_pVIDlg != NULL)
{
m_pVIDlg->Create(IDD_DLGVIEW_INFO,this);
m_pVIDlg->ShowWindow(SW_HIDE);
}

m_pSCDlg = new CDlgShowcmd(this);     //显示下发命令和接收到的命令
if(m_pSCDlg != NULL)
{
m_pSCDlg->Create(IDD_SHOWCMD,this);
m_pSCDlg->ShowWindow(SW_HIDE);请问这里面的this分别有什么用啊,this 在这里应该是CMainFrame的对象指针吧?可以省去么??
还有Create为什么只有两个参数???解释一下这两参数??谢谢!

解决方案 »

  1.   

    BOOL CDialog::Create( UINT nIDTemplate, CWnd* pParentWnd = NULL );
    参数的含义——》
    UINT nIDTemplate——对话框模板ID
    CWnd* pParentWnd = NULL——父窗口指针
    pParentWndPoints to the parent window object (of type CWnd) to which the dialog object belongs. If it is NULL, the dialog object’s parent window is set to the main application window.nIDTemplateContains the ID number of a dialog-box template resource.
      

  2.   

    this表示当前类成员函数的类对象指针
      

  3.   

    用this表示当前窗口是要创建的窗口的父窗口,可以用NULL,也可以用别的窗口指针来代替
    两个参数是因为别的都用了缺省值了