[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

@ -22,6 +22,18 @@ CMainWindow mainWindow;
/* FUNCTIONS ********************************************************/
void ShowOutOfMemory(void)
{
WCHAR szText[256];
::FormatMessageW(FORMAT_MESSAGE_IGNORE_INSERTS | FORMAT_MESSAGE_FROM_SYSTEM,
NULL,
ERROR_OUTOFMEMORY,
0,
szText, _countof(szText),
NULL);
mainWindow.MessageBox(szText, NULL, MB_ICONERROR);
}
// get file name extension from filter string
static BOOL
FileExtFromFilter(LPTSTR pExt, OPENFILENAME *pOFN)