@@ -44,6 +44,7 @@ static unsigned int BankedCartOffset[MAXPAX]={0,0,0,0};
4444static unsigned char Temp,Temp2;
4545static char IniFile[MAX_PATH]=" " ;
4646static char MPIPath[MAX_PATH];
47+ void CenterDialog (HWND);
4748
4849using namespace std ;
4950
@@ -419,6 +420,16 @@ extern "C"
419420 }
420421}
421422
423+ void CenterDialog (HWND hDlg)
424+ {
425+ RECT rPar, rDlg;
426+ GetWindowRect (GetParent (hDlg), &rPar);
427+ GetWindowRect (hDlg, &rDlg);
428+ int x = rPar.left + (rPar.right - rPar.left - (rDlg.right - rDlg.left )) / 2 ;
429+ int y = rPar.top + (rPar.bottom - rPar.top - (rDlg.bottom - rDlg.top )) / 2 ;
430+ SetWindowPos (hDlg, NULL , x, y, 0 , 0 , SWP_NOSIZE | SWP_NOZORDER);
431+ }
432+
422433LRESULT CALLBACK Config (HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
423434{
424435 unsigned short EDITBOXS[4 ]={IDC_EDIT1,IDC_EDIT2,IDC_EDIT3,IDC_EDIT4};
@@ -434,7 +445,7 @@ LRESULT CALLBACK Config(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
434445 EndDialog (hDlg, LOWORD (wParam));
435446
436447 case WM_INITDIALOG:
437-
448+ CenterDialog (hDlg);
438449 hConfDlg=hDlg;
439450 for (Temp=0 ;Temp<4 ;Temp++)
440451 SendDlgItemMessage (hDlg,EDITBOXS[Temp],WM_SETTEXT,0 ,(LPARAM)(LPCSTR) SlotLabel[Temp] );
0 commit comments