Skip to content
Permalink
Browse files

Merge pull request #12 from irwir/updates

Fix a dangerous bug in CResizableLayout::AddAllOtherAnchors
Clear a rare debug assert in CResizableFormView::GetTotalClientRect
  • Loading branch information...
ppescher committed Jan 13, 2019
2 parents ad4b6ab + c8b5d86 commit 17ff3890df57ab18689d337e009e0df06349f6a7
Showing with 6 additions and 6 deletions.
  1. +5 −5 ResizableLib/ResizableFormView.cpp
  2. +1 −1 ResizableLib/ResizableLayout.cpp
@@ -128,16 +128,16 @@ void CResizableFormView::OnSize(UINT nType, int cx, int cy)
void CResizableFormView::GetTotalClientRect(LPRECT lpRect) const
{
GetClientRect(lpRect);
// done, if there are no active scrollbars
if (!(GetStyle() & (WS_HSCROLL | WS_VSCROLL)))
return;

// get dialog template's size
// (this is set in CFormView::Create)
CSize sizeTotal, sizePage, sizeLine;
int nMapMode = 0;
int nMapMode;
GetDeviceScrollSizes(nMapMode, sizeTotal, sizePage, sizeLine);

// otherwise, give the correct size if scrollbars active

if (nMapMode < 0) // scrollbars disabled
if (nMapMode <= 0) // scrollbars disabled (invalid mapping mode)
return;

// enlarge reported client area when needed
@@ -126,7 +126,7 @@ void CResizableLayout::AddAllOtherAnchors(ANCHOR anchorTopLeft, ANCHOR anchorBot
for (; hWnd != NULL; hWnd = ::GetNextWindow(hWnd, GW_HWNDNEXT))
{
TCHAR szClassName[32];
if (::GetClassName(hWnd, szClassName, sizeof(szClassName)))
if (::GetClassName(hWnd, szClassName, _countof(szClassName)))
{
if (lstrcmp(szClassName, WC_SCROLLBAR) == 0)
{

0 comments on commit 17ff389

Please sign in to comment.
You can’t perform that action at this time.