创建非模态对话框

来源:互联网 发布:第三方登录数据库设计 编辑:程序博客网 时间:2024/05/21 22:42
 

模态对话框是DoModal出来的,而非模态对话框是Create创建的。

 

CTestDlg* oCTestDlg;

oCTestDlg = new CTestDlg (this);

oCTestDlg->Create( IDD_MEDIA_SERVER_SPACE_ALERT, this );

CRect rect;

this->GetClientRect( &rect );

CRect rectDisk;

oCTestDlg->GetWindowRect( &rectDisk );

 

oCTestDlg->SetWindowPos( NULL,

                         rect.CenterPoint().x - rectDisk.Width() / 2,

                         rect.CenterPoint().y - rectDisk.Height() / 2,

                         rectDisk.Width(),

                         rectDisk.Height(),

                         SWP_NOZORDER

                         );

oCTestDlg->ShowWindow( SW_SHOW );

 

上例为在父对话框的中间弹出非模态对话框。