为什么自定义对话框老显示在后面?
test.cpp中
CDlg2 *c=new CDlg2();c->Create(IDD_DIALOG2); 
//c.SetActiveWindow();//加这句也是一样
c->ShowWindow(SW_SHOW);这什么原因?

解决方案 »

  1.   

    c- >Create(IDD_DIALOG2, this);  
      

  2.   

    我用的是自定义对话框
    CDlgBase base(IDD_DIALOG1,this);如果定义为全局的话,这this从哪里取得?
      

  3.   

    全局?CDlgBase base(IDD_DIALOG1,AfxGetMainWnd()); 
      

  4.   

     CDlgBase base(IDD_DIALOG1,this);
    出错error C2355: 'this' : can only be referenced inside non-static member functions
    CMainFrame cc;
    CDlgBase base(IDD_DIALOG1,cc);这样也不行 cannot access protected member declared in class 'CMainFrame'
      

  5.   

    CDlgBase base(IDD_DIALOG1,AfxGetMainWnd());这样的话状态栏变成两个窗口了
    这对话框已经独立了
      

  6.   

    CDlgBase base(IDD_DIALOG1,AfxGetMainWnd());base.Create(IDD_DIALOG1); base.SetWindowPos   (NULL,0,25,500,600,SWP_SHOWWINDOW);  还是一样,对话框显示在后面
      

  7.   

    谢谢,可以了
    base.Create(IDD_DIALOG1);  
    改为
    base.Create(IDD_DIALOG1,this);