1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-07-03 20:42:48 -05:00

Windows: utility function to centre a window.

This was called from config box setup, and is obviously the kind of
thing that ought to be a reusable utility function.
This commit is contained in:
Simon Tatham
2022-04-24 13:34:15 +01:00
parent 69e8d471d1
commit cccdab9ba6
4 changed files with 25 additions and 13 deletions

View File

@ -348,7 +348,7 @@ static INT_PTR GenericMainDlgProc(HWND hwnd, UINT msg, WPARAM wParam,
LPARAM lParam, void *ctx)
{
const int DEMO_SCREENSHOT_TIMER_ID = 1230;
HWND hw, treeview;
HWND treeview;
struct treeview_faff tvfaff;
int ret;
@ -369,19 +369,8 @@ static INT_PTR GenericMainDlgProc(HWND hwnd, UINT msg, WPARAM wParam,
}
SendMessage(hwnd, WM_SETICON, (WPARAM) ICON_BIG,
(LPARAM) LoadIcon(hinst, MAKEINTRESOURCE(IDI_CFGICON)));
/*
* Centre the window.
*/
{ /* centre the window */
RECT rs, rd;
hw = GetDesktopWindow();
if (GetWindowRect(hw, &rs) && GetWindowRect(hwnd, &rd))
MoveWindow(hwnd,
(rs.right + rs.left + rd.left - rd.right) / 2,
(rs.bottom + rs.top + rd.top - rd.bottom) / 2,
rd.right - rd.left, rd.bottom - rd.top, true);
}
centre_window(hwnd);
/*
* Create the tree view.