| 1394 | } |
| 1395 | |
| 1396 | void CenterWindow(HWND hWnd, HWND hRelativeTo) |
| 1397 | { |
| 1398 | RECT rect1, rect2; |
| 1399 | GetWindowRect(hWnd, &rect1); |
| 1400 | GetWindowRect(hRelativeTo, &rect2); |
| 1401 | |
| 1402 | OffsetRect(&rect1, -rect1.left, -rect1.top); |
| 1403 | int width = rect1.right - rect1.left, height = rect1.bottom - rect1.top; |
| 1404 | |
| 1405 | OffsetRect( |
| 1406 | &rect1, |
| 1407 | (rect2.left + rect2.right) / 2 - (rect1.right - rect1.left) / 2, |
| 1408 | (rect2.top + rect2.bottom) / 2 - (rect1.bottom - rect1.top) / 2 |
| 1409 | ); |
| 1410 | |
| 1411 | MoveWindow(hWnd, rect1.left, rect1.top, rect1.right - rect1.left, rect1.bottom - rect1.top, TRUE); |
| 1412 | } |
| 1413 | |
| 1414 | #ifndef MINGW_SPECIFIC_HACKS |
| 1415 | #include <mutex> |
no outgoing calls
no test coverage detected