设置对话框弹出位置在屏幕中心
- //调整对话框的位置test 2023.6.16
- CRect rectMain;
- GetWindowRect(&rectMain);
- CRect rectScreen;
- SystemParametersInfo(SPI_GETWORKAREA,0,&rectScreen,0);
-
- int nWidth=rectMain.Width();
- int nHeight=rectMain.Height();
-
- int nLeft=rectScreen.left+(rectScreen.Width()-nWidth)/2;
- int nTop=rectScreen.top+(rectScreen.Height()-nHeight)/2;
-
- SetWindowPos(NULL,nLeft,nTop,nWidth,nHeight,SWP_NOSIZE);
- //end
-