Index: src/ch/ch.cpp =================================================================== diff -u -r39864b5fbb931e3b257afbd60cfb7f36f71d146d -r607e0afdab47aafcab9f123a31869aa908164ce7 --- src/ch/ch.cpp (.../ch.cpp) (revision 39864b5fbb931e3b257afbd60cfb7f36f71d146d) +++ src/ch/ch.cpp (.../ch.cpp) (revision 607e0afdab47aafcab9f123a31869aa908164ce7) @@ -270,7 +270,8 @@ // ================================= Handle command line ================================== // parse the command line this early, so we can support as much options as possible in the future // (i.e. override the defaults used below) - m_cmdLineParser.ParseCommandLine(::GetCommandLine()); + if (!ParseCommandLine()) + return FALSE; // ================================= Configuration ======================================== CString strPath; @@ -457,6 +458,30 @@ #endif } +bool CCopyHandlerApp::ParseCommandLine() +{ + CString strError; + try + { + m_cmdLineParser.ParseCommandLine(::GetCommandLine()); + } + catch (const std::exception& e) + { + strError = e.what(); + } + + if (!strError.IsEmpty()) + { + CString strFmt; + strFmt.Format(_T("Error processing command line options. Reason: %s"), (PCTSTR) strError); + AfxMessageBox(strFmt, MB_OK | MB_ICONERROR); + + return false; + } + + return true; +} + void CCopyHandlerApp::InitShellExtension() { // validate ch version against extension version Index: src/ch/ch.h =================================================================== diff -u -r1e687d59f0e622a610cbf97cf79febd12641d159 -r607e0afdab47aafcab9f123a31869aa908164ce7 --- src/ch/ch.h (.../ch.h) (revision 1e687d59f0e622a610cbf97cf79febd12641d159) +++ src/ch/ch.h (.../ch.h) (revision 607e0afdab47aafcab9f123a31869aa908164ce7) @@ -66,6 +66,7 @@ HWND HHelp(HWND hwndCaller, LPCTSTR pszFile, UINT uCommand, DWORD_PTR dwData); void InitShellExtension(); + bool ParseCommandLine(); protected: TShellExtensionClient m_tShellExtClient;