OSDN Git Service

PATCH: [ 915790 ] Open Contributors.rtf from About dialog - handle more errors
authorKimmo Varis <kimmov@gmail.com>
Wed, 17 Mar 2004 16:05:11 +0000 (16:05 +0000)
committerKimmo Varis <kimmov@gmail.com>
Wed, 17 Mar 2004 16:05:11 +0000 (16:05 +0000)
Src/Merge.cpp
Src/readme.txt

index 0f05652..a145f02 100644 (file)
@@ -737,6 +737,7 @@ void CAboutDlg::OnBnClickedOpenContributors()
        CString defPath = GetModulePath();
        // Don't add quotation marks yet, CFile doesn't like them
        CString docPath = defPath + _T("\\Docs\\Contributors.rtf");
+       HINSTANCE ret = 0;
        
        CFileStatus status;
        if (CFile::GetStatus(docPath, status))
@@ -745,7 +746,20 @@ void CAboutDlg::OnBnClickedOpenContributors()
                // includes spaces
                docPath.Insert(0, _T("\""));
                docPath.Insert(docPath.GetLength(), _T("\""));
-               ShellExecute(m_hWnd, NULL, _T("wordpad"), docPath, defPath, SW_SHOWNORMAL);
+               ret = ShellExecute(m_hWnd, NULL, _T("wordpad"), docPath, defPath, SW_SHOWNORMAL);
+
+               // values < 32 are errors (ref to MSDN)
+               if ((int)ret < 32)
+               {
+                       // Try to open with ssociated application (.rtf)
+                       ret = ShellExecute(m_hWnd, _T("open"), docPath, NULL, NULL, SW_SHOWNORMAL);
+                       if ((int)ret < 32)
+                       {
+                               CString msg;
+                               AfxFormatString1(msg, IDS_CANNOT_EXECUTE_FILE, _T("WordPad.exe"));
+                               AfxMessageBox(msg, MB_OK | MB_ICONSTOP);
+                       }
+               }
        }
        else
        {
index ae1a573..786bbea 100644 (file)
@@ -5,6 +5,9 @@
   Src/res new files: change_pane.bmp go_to.bmp language.bmp replace.bmp select_font.bmp
   Languages: *.rc resource.h
   Languages/res new files: change_pane.bmp go_to.bmp language.bmp replace.bmp select_font.bmp
+ PATCH: [ 915790 ] Open Contributors.rtf from About dialog
+  Handle errors if wordpad or associated app couldn't be run.
+  Src: Merge.cpp
 
 2004-03-16 Seier
   Installer [Patch 917142]: