CenterWindow now with less build breaking
This commit is contained in:
parent
16f13d5d22
commit
a9911ff6d7
|
@ -68,6 +68,8 @@ void CenterWindow(HWND hwndDlg) {
|
||||||
//TODO: This function should probably moved into the generic Win32 window file
|
//TODO: This function should probably moved into the generic Win32 window file
|
||||||
//move the window relative to its parent
|
//move the window relative to its parent
|
||||||
HWND hwndParent = GetParent(hwndDlg);
|
HWND hwndParent = GetParent(hwndDlg);
|
||||||
|
RECT rect;
|
||||||
|
RECT rectP;
|
||||||
|
|
||||||
GetWindowRect(hwndDlg, &rect);
|
GetWindowRect(hwndDlg, &rect);
|
||||||
GetWindowRect(hwndParent, &rectP);
|
GetWindowRect(hwndParent, &rectP);
|
||||||
|
@ -75,8 +77,8 @@ void CenterWindow(HWND hwndDlg) {
|
||||||
unsigned int width = rect.right - rect.left;
|
unsigned int width = rect.right - rect.left;
|
||||||
unsigned height = rect.bottom - rect.top;
|
unsigned height = rect.bottom - rect.top;
|
||||||
|
|
||||||
x = ((rectP.right-rectP.left) - width) / 2 + rectP.left;
|
unsigned x = ((rectP.right-rectP.left) - width) / 2 + rectP.left;
|
||||||
y = ((rectP.bottom-rectP.top) - height) / 2 + rectP.top;
|
unsigned y = ((rectP.bottom-rectP.top) - height) / 2 + rectP.top;
|
||||||
|
|
||||||
unsigned screenwidth = GetSystemMetrics(SM_CXSCREEN);
|
unsigned screenwidth = GetSystemMetrics(SM_CXSCREEN);
|
||||||
unsigned screenheight = GetSystemMetrics(SM_CYSCREEN);
|
unsigned screenheight = GetSystemMetrics(SM_CYSCREEN);
|
||||||
|
|
Loading…
Reference in New Issue