[MSPAINT] Show out-of-memory message (#5817)

- Improve ImageModel::PushImageForUndo.
- Use FormatMessage in newly added
  ShowOutOfMemory function.
- Call ShowOutOfMemory() when out of memory.
CORE-19227, CORE-19094
This commit is contained in:
Katayama Hirofumi MZ 2023-10-25 02:35:49 +09:00 committed by GitHub
parent 501c2bdd63
commit ab199cc147
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 43 additions and 7 deletions

View file

@ -228,7 +228,10 @@ HBITMAP InitializeImage(LPCWSTR name, LPWIN32_FIND_DATAW pFound, BOOL isFile)
COLORREF white = RGB(255, 255, 255);
HBITMAP hBitmap = CreateColorDIB(registrySettings.BMPWidth, registrySettings.BMPHeight, white);
if (hBitmap == NULL)
{
ShowOutOfMemory();
return NULL;
}
HDC hScreenDC = ::GetDC(NULL);
g_xDpi = (float)::GetDeviceCaps(hScreenDC, LOGPIXELSX);