[MSPAINT] Fix use of uninitialized variable on startup (#5140)

There was an exception in starting up of mspaint of Visual Studio 2019 build. CORE-18594, CORE-18867
This commit is contained in:
Katayama Hirofumi MZ 2023-03-10 07:31:31 +09:00 committed by GitHub
parent 29d0deef13
commit 02c647802f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -72,17 +72,18 @@ void CMainWindow::alignChildrenToMainWindow()
h = clientRect.bottom - 3;
}
RECT statusBarRect0;
int statusBarBorders[3];
if (::IsWindow(hStatusBar))
INT statusBarHeight = 0;
if (::IsWindowVisible(hStatusBar))
{
::SendMessage(hStatusBar, SB_GETRECT, 0, (LPARAM)&statusBarRect0);
::SendMessage(hStatusBar, SB_GETBORDERS, 0, (LPARAM)&statusBarBorders);
RECT Rect;
INT borders[3];
::SendMessage(hStatusBar, SB_GETRECT, 0, (LPARAM)&Rect);
::SendMessage(hStatusBar, SB_GETBORDERS, 0, (LPARAM)&borders);
statusBarHeight = Rect.bottom - Rect.top + borders[1];
}
int statusBarHeight = statusBarRect0.bottom - statusBarRect0.top + statusBarBorders[1];
if (scrollboxWindow.IsWindow())
scrollboxWindow.MoveWindow(x, y, w, ::IsWindowVisible(hStatusBar) ? h - statusBarHeight : h, TRUE);
scrollboxWindow.MoveWindow(x, y, w, h - statusBarHeight, TRUE);
if (paletteWindow.IsWindow())
paletteWindow.MoveWindow(x, 9, 255, 32, TRUE);
}