@@ -154,6 +154,13 @@ void UpdateWindowTitle(HWND hWnd)
154154 SetWindowTextW (hWnd, title);
155155}
156156
157+ void ShowErrorMessageBox (HWND hWnd, const std::string& msg)
158+ {
159+ std::error_code ec (m_pImgMergeWindow->GetLastErrorCode (), std::generic_category ());
160+ std::string msg2 = msg + " : " + ec.message ();
161+ MessageBoxA (hWnd, msg2.c_str (), NULL , MB_OK | MB_ICONERROR);
162+ }
163+
157164bool NewImages (HWND hWnd, int nImages)
158165{
159166 bool bSucceeded;
@@ -173,6 +180,8 @@ bool OpenImages(HWND hWnd, int nImages, const std::wstring filename[3])
173180 bSucceeded = m_pImgMergeWindow->OpenImages (filename[0 ].c_str (), filename[1 ].c_str (), filename[2 ].c_str ());
174181 if (bSucceeded)
175182 UpdateWindowTitle (hWnd);
183+ else
184+ ShowErrorMessageBox (hWnd, " Failed to open files" );
176185 InvalidateRect (hWnd, NULL , TRUE );
177186 return bSucceeded;
178187}
@@ -199,9 +208,7 @@ void SaveImageAs(HWND hWnd, int pane)
199208 if (GetSaveFileNameW (&ofn) != 0 )
200209 {
201210 if (!m_pImgMergeWindow->SaveImageAs (pane, ofn.lpstrFile ))
202- {
203- MessageBoxW (hWnd, L" Failed to save file" , nullptr , MB_OK | MB_ICONERROR);
204- }
211+ ShowErrorMessageBox (hWnd, " Failed to save file" );
205212 }
206213}
207214
@@ -830,7 +837,7 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
830837 case ID_HELP_ABOUT:
831838 MessageBoxW (hWnd,
832839 L" WinIMerge\n\n "
833- L" (c) 2014-2021 sdottaka@users.sourceforge.net All rights reserved.\n\n "
840+ L" (c) 2014-2025 sdottaka@users.sourceforge.net All rights reserved.\n\n "
834841 L" This software uses the FreeImage open source image library. \n "
835842 L" See http://freeimage.sourceforge.net for details.\n "
836843 L" FreeImage is used under the GNU GPL version.\n " , L" WinIMerge" , MB_OK | MB_ICONINFORMATION);
0 commit comments