if (NULL != _devListDlg)
{
delete _devListDlg;
}
_devListDlg = new CDeviceList;
_devListDlg->Create(IDD_DEVICELIST, this);
_devListDlg->initDlg(CDeviceList::Proc(&CDHVisionDlg::OnConnect, this));
/// 将设备列表窗口移到合适位置
CRect rect, rectSelf;
_devListDlg->GetClientRect(&rect);//获取Dlg客户区坐标
GetClientRect(&rectSelf);
this->ClientToScreen(&rectSelf);//客户区坐标转换为屏幕坐标
int x = rectSelf.TopLeft().x + rectSelf.TopLeft().x / 2;
int y = rectSelf.TopLeft().y + rectSelf.TopLeft().y / 2;
int width = rect.Width();
int height = rect.Height();
_devListDlg->MoveWindow(x, y, width, height);
_devListDlg->ShowWindow(SW_SHOW);
_devListDlg为弹出的非模态窗口变量.
效果图: