* Centers a window on the screen. * * @param hwnd The window handle. **/
| 45 | * @param hwnd The window handle. |
| 46 | **/ |
| 47 | void CenterWindowOnScreen(HWND hwnd) |
| 48 | { |
| 49 | RECT rect; |
| 50 | |
| 51 | GetWindowRect(hwnd, &rect); |
| 52 | |
| 53 | unsigned int screenwidth = GetSystemMetrics(SM_CXSCREEN); |
| 54 | unsigned int screenheight = GetSystemMetrics(SM_CYSCREEN); |
| 55 | |
| 56 | unsigned int width = rect.right - rect.left; |
| 57 | unsigned height = rect.bottom - rect.top; |
| 58 | |
| 59 | unsigned x = (screenwidth - width) / 2; |
| 60 | unsigned y = (screenheight - height) / 2; |
| 61 | |
| 62 | MoveWindow(hwnd, x, y, width, height, FALSE); |
| 63 | } |
| 64 | |
| 65 | /** |
| 66 | * Changes the state of the mouse cursor. |
no outgoing calls
no test coverage detected