我在一个对话框的OnInitDialog事件中,调用CDialog::Create创建了另一个对话框,
为什么这个对话框总是显示在原来对话框的上层。无论在Create中是否使用this最为父窗口。
SetWindowPos也没用。

解决方案 »

  1.   

    设置visible属性为不可见
    或者ShowWindow(SW_HIDE);
      

  2.   

    修改原始对话框的创建方法,当你创建一个DIALOG BASE的应用的时候,修改“应用程序名.CPP”可以看到MFC的代码是domodal的改为create就ok了:)
      

  3.   

    Creat或者是ShowWhidow都是马上返回,所以程序会马上就退出了。我也很想知道这个问题的解决办法,希望各位大哥帮忙啊
      

  4.   

    如果是基于对话框的程序在APP类的InitInstance函数中的:
    CDialogTestDlg dlg;
    m_pMainWnd = &dlg;
    ////在这里Create另一个对话框。
    int nResponse = dlg.DoModal();
    if (nResponse == IDOK)
    {
    // TODO: Place code here to handle when the dialog is
    //  dismissed with OK
    }
    else if (nResponse == IDCANCEL)
    {
    // TODO: Place code here to handle when the dialog is
    //  dismissed with Cancel
    } // Since the dialog has been closed, return FALSE so that we exit the
    //  application, rather than start the application's message pump.
    return FALSE;