Index: reactos/base/applications/mspaint/history.cpp =================================================================== --- reactos/base/applications/mspaint/history.cpp (revision 74717) +++ reactos/base/applications/mspaint/history.cpp (working copy) @@ -129,6 +129,11 @@ int oldWidth = GetWidth(); int oldHeight = GetHeight(); + if (nWidth <= 0) + nWidth = 1; + if (nHeight <= 0) + nHeight = 1; + SelectObject(hDrawingDC, hBms[currInd]); DeleteObject(hBms[(currInd + 1) % HISTORYSIZE]); hBms[(currInd + 1) % HISTORYSIZE] = CreateDIBWithProperties(nWidth, nHeight); Index: reactos/base/applications/mspaint/sizebox.cpp =================================================================== --- reactos/base/applications/mspaint/sizebox.cpp (revision 74717) +++ reactos/base/applications/mspaint/sizebox.cpp (working copy) @@ -12,9 +12,9 @@ /* FUNCTIONS ********************************************************/ -BOOL resizing = FALSE; -short xOrig; -short yOrig; +static BOOL resizing = FALSE; +static short xOrig; +static short yOrig; LRESULT CSizeboxWindow::OnSetCursor(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled) { @@ -76,8 +76,6 @@ { short xRel; short yRel; - ReleaseCapture(); - resizing = FALSE; int imgXRes = imageModel.GetWidth(); int imgYRes = imageModel.GetHeight(); xRel = (GET_X_LPARAM(lParam) - xOrig) * 1000 / toolsModel.GetZoom(); @@ -100,5 +98,13 @@ imageModel.Crop(imgXRes + xRel, imgYRes + yRel, 0, 0); SendMessage(hStatusBar, SB_SETTEXT, 2, (LPARAM) _T("")); } + ReleaseCapture(); + resizing = FALSE; return 0; } + +LRESULT CSizeboxWindow::OnCancelMode(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled) +{ + resizing = FALSE; + return 0; +} Index: reactos/base/applications/mspaint/sizebox.h =================================================================== --- reactos/base/applications/mspaint/sizebox.h (revision 74717) +++ reactos/base/applications/mspaint/sizebox.h (working copy) @@ -16,6 +16,7 @@ MESSAGE_HANDLER(WM_LBUTTONDOWN, OnLButtonDown) MESSAGE_HANDLER(WM_MOUSEMOVE, OnMouseMove) MESSAGE_HANDLER(WM_LBUTTONUP, OnLButtonUp) + MESSAGE_HANDLER(WM_CANCELMODE, OnCancelMode) END_MSG_MAP() LRESULT OnSetCursor(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled); @@ -22,4 +23,5 @@ LRESULT OnLButtonDown(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled); LRESULT OnMouseMove(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled); LRESULT OnLButtonUp(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled); + LRESULT OnCancelMode(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled); };