[MSPAINT] Fix CMainWindow::GetSaveFileName (#5356)

Fix filename extension cases and "File Type" field. If no filename extension on save, then append ".png" to the filename.
CORE-18867
This commit is contained in:
Katayama Hirofumi MZ 2023-06-19 14:15:18 +09:00 committed by GitHub
parent 64ef3ced9c
commit 19d8862851
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -123,13 +123,18 @@ BOOL CMainWindow::GetSaveFileName(IN OUT LPTSTR pszFile, INT cchMaxFile)
sfn.lpfnHook = OFNHookProc;
sfn.lpstrDefExt = L"png";
// Choose PNG
for (INT i = 0; i < aguidFileTypesE.GetSize(); ++i)
LPWSTR pchDotExt = PathFindExtensionW(pszFile);
if (*pchDotExt == UNICODE_NULL)
{
if (aguidFileTypesE[i] == Gdiplus::ImageFormatPNG)
// Choose PNG
wcscat(pszFile, L".png");
for (INT i = 0; i < aguidFileTypesE.GetSize(); ++i)
{
sfn.nFilterIndex = i + 1;
break;
if (aguidFileTypesE[i] == Gdiplus::ImageFormatPNG)
{
sfn.nFilterIndex = i + 1;
break;
}
}
}
}