Center install wizard.

Don't skip to next page as long as required data have not been entered.

svn path=/trunk/; revision=9467
This commit is contained in:
Eric Kohl 2004-05-22 12:04:10 +00:00
parent dd55a50761
commit a197c442b7

View file

@ -16,7 +16,7 @@
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/ */
/* $Id: wizard.c,v 1.2 2004/04/19 10:54:23 ekohl Exp $ /* $Id: wizard.c,v 1.3 2004/05/22 12:04:10 ekohl Exp $
* *
* COPYRIGHT: See COPYING in the top level directory * COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS system libraries * PROJECT: ReactOS system libraries
@ -46,6 +46,29 @@ static SETUPDATA SetupData;
/* FUNCTIONS ****************************************************************/ /* FUNCTIONS ****************************************************************/
static VOID
CenterWindow(HWND hWnd)
{
HWND hWndParent;
RECT rcParent;
RECT rcWindow;
hWndParent = GetParent(hWnd);
if (hWndParent == NULL)
hWndParent = GetDesktopWindow();
GetWindowRect(hWndParent, &rcParent);
GetWindowRect(hWnd, &rcWindow);
SetWindowPos(hWnd,
HWND_TOP,
((rcParent.right - rcParent.left) - (rcWindow.right - rcWindow.left)) / 2,
((rcParent.bottom - rcParent.top) - (rcWindow.bottom - rcWindow.top)) / 2,
0,
0,
SWP_NOSIZE);
}
BOOL CALLBACK BOOL CALLBACK
WelcomeDlgProc(HWND hwndDlg, WelcomeDlgProc(HWND hwndDlg,
@ -60,8 +83,12 @@ WelcomeDlgProc(HWND hwndDlg,
HWND hwndControl; HWND hwndControl;
DWORD dwStyle; DWORD dwStyle;
/* Hide the system menu */
hwndControl = GetParent(hwndDlg); hwndControl = GetParent(hwndDlg);
/* Center the wizard window */
CenterWindow (hwndControl);
/* Hide the system menu */
dwStyle = GetWindowLong(hwndControl, GWL_STYLE); dwStyle = GetWindowLong(hwndControl, GWL_STYLE);
SetWindowLong(hwndControl, GWL_STYLE, dwStyle & ~WS_SYSMENU); SetWindowLong(hwndControl, GWL_STYLE, dwStyle & ~WS_SYSMENU);
@ -93,6 +120,7 @@ WelcomeDlgProc(HWND hwndDlg,
default: default:
break; break;
} }
return FALSE; return FALSE;
} }
@ -140,7 +168,8 @@ OwnerPageDlgProc(HWND hwndDlg,
_T("Setup cannot continue until you enter your name."), _T("Setup cannot continue until you enter your name."),
_T("ReactOS Setup"), _T("ReactOS Setup"),
MB_ICONERROR | MB_OK); MB_ICONERROR | MB_OK);
return -1; SetWindowLong(hwndDlg, DWL_MSGRESULT, -1);
return TRUE;
} }
GetDlgItemText(hwndDlg, IDC_OWNERORGANIZATION, SetupData->OwnerOrganization, 50); GetDlgItemText(hwndDlg, IDC_OWNERORGANIZATION, SetupData->OwnerOrganization, 50);
break; break;
@ -155,7 +184,7 @@ OwnerPageDlgProc(HWND hwndDlg,
break; break;
} }
return 0; return FALSE;
} }
@ -215,7 +244,8 @@ ComputerPageDlgProc(HWND hwndDlg,
_T("Setup cannot continue until you enter the name of your computer."), _T("Setup cannot continue until you enter the name of your computer."),
_T("ReactOS Setup"), _T("ReactOS Setup"),
MB_ICONERROR | MB_OK); MB_ICONERROR | MB_OK);
return -1; SetWindowLong(hwndDlg, DWL_MSGRESULT, -1);
return TRUE;
} }
/* FIXME: check computer name for invalid characters */ /* FIXME: check computer name for invalid characters */
@ -230,7 +260,8 @@ ComputerPageDlgProc(HWND hwndDlg,
"the desired password again."), "the desired password again."),
_T("ReactOS Setup"), _T("ReactOS Setup"),
MB_ICONERROR | MB_OK); MB_ICONERROR | MB_OK);
return -1; SetWindowLong(hwndDlg, DWL_MSGRESULT, -1);
return TRUE;
} }
/* FIXME: check password for invalid characters */ /* FIXME: check password for invalid characters */
@ -247,6 +278,7 @@ ComputerPageDlgProc(HWND hwndDlg,
default: default:
break; break;
} }
return FALSE; return FALSE;
} }
@ -292,7 +324,7 @@ FinishDlgProc(HWND hwndDlg,
break; break;
} }
return 0; return FALSE;
} }