CenterWindow now with less build breaking

This commit is contained in:
rheiny 2006-08-03 19:48:05 +00:00
parent 16f13d5d22
commit a9911ff6d7
1 changed files with 4 additions and 2 deletions

View File

@ -68,6 +68,8 @@ void CenterWindow(HWND hwndDlg) {
//TODO: This function should probably moved into the generic Win32 window file
//move the window relative to its parent
HWND hwndParent = GetParent(hwndDlg);
RECT rect;
RECT rectP;
GetWindowRect(hwndDlg, &rect);
GetWindowRect(hwndParent, &rectP);
@ -75,8 +77,8 @@ void CenterWindow(HWND hwndDlg) {
unsigned int width = rect.right - rect.left;
unsigned height = rect.bottom - rect.top;
x = ((rectP.right-rectP.left) - width) / 2 + rectP.left;
y = ((rectP.bottom-rectP.top) - height) / 2 + rectP.top;
unsigned x = ((rectP.right-rectP.left) - width) / 2 + rectP.left;
unsigned y = ((rectP.bottom-rectP.top) - height) / 2 + rectP.top;
unsigned screenwidth = GetSystemMetrics(SM_CXSCREEN);
unsigned screenheight = GetSystemMetrics(SM_CYSCREEN);