Index: src/ch/FeedbackFileErrorDlg.cpp =================================================================== diff -u -r22bbc4a87fa0b249e1e02ba385f28da9d77a4aa1 -r8068e0c351055554340ac9755d1bc846893bf2b8 --- src/ch/FeedbackFileErrorDlg.cpp (.../FeedbackFileErrorDlg.cpp) (revision 22bbc4a87fa0b249e1e02ba385f28da9d77a4aa1) +++ src/ch/FeedbackFileErrorDlg.cpp (.../FeedbackFileErrorDlg.cpp) (revision 8068e0c351055554340ac9755d1bc846893bf2b8) @@ -3,22 +3,23 @@ #include "stdafx.h" #include "ch.h" -#include "FileInfo.h" +#include "../libchcore/TFileInfo.h" #include "FeedbackFileErrorDlg.h" #include "FeedbackHandler.h" +#include "../libchcore/TWin32ErrorFormatter.h" +#include "resource.h" // CFeedbackFileErrorDlg dialog IMPLEMENT_DYNAMIC(CFeedbackFileErrorDlg, ictranslate::CLanguageDialog) -CFeedbackFileErrorDlg::CFeedbackFileErrorDlg(const tchar_t* pszSrcPath, const tchar_t* pszDstPath, ulong_t ulSysError, CWnd* pParent /*=NULL*/) +CFeedbackFileErrorDlg::CFeedbackFileErrorDlg(const wchar_t* pszSrcPath, const wchar_t* pszDstPath, unsigned long ulSysError, CWnd* pParent /*=nullptr*/) : ictranslate::CLanguageDialog(IDD_FEEDBACK_FILE_ERROR_DIALOG, pParent), m_bAllItems(FALSE), m_strSrcPath(pszSrcPath), m_strDstPath(pszDstPath), m_ulSysError(ulSysError) { - } CFeedbackFileErrorDlg::~CFeedbackFileErrorDlg() @@ -64,18 +65,12 @@ strFmt += rResManager.LoadString(IDS_INFO_REASON_STRING); // get system error string - TCHAR szSystem[1024]; - DWORD dwPos=FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM, NULL, m_ulSysError, 0, szSystem, 1023, NULL); - szSystem[1023] = _T('\0'); + chcore::TString strError = chcore::TWin32ErrorFormatter::FormatWin32ErrorCode(m_ulSysError, true); - // get rid of \r\n at the end of szSystem - while(--dwPos && (szSystem[dwPos] == 0x0a || szSystem[dwPos] == 0x0d)) - szSystem[dwPos]=_T('\0'); - ictranslate::CFormat fmt(strFmt); - fmt.SetParam(_t("%filename"), m_strSrcPath); - fmt.SetParam(_t("%dstfilename"), m_strDstPath); - fmt.SetParam(_t("%reason"), szSystem); + fmt.SetParam(_T("%filename"), m_strSrcPath); + fmt.SetParam(_T("%dstfilename"), m_strDstPath); + fmt.SetParam(_T("%reason"), strError.c_str()); m_ctlErrorInfo.SetWindowText(fmt); @@ -86,23 +81,23 @@ void CFeedbackFileErrorDlg::OnBnClickedRetryButton() { UpdateData(TRUE); - EndDialog(CFeedbackHandler::eResult_Retry); + EndDialog(chcore::EFeedbackResult::eResult_Retry); } void CFeedbackFileErrorDlg::OnBnClickedSkipButton() { UpdateData(TRUE); - EndDialog(CFeedbackHandler::eResult_Skip); + EndDialog(chcore::EFeedbackResult::eResult_Skip); } void CFeedbackFileErrorDlg::OnBnClickedPauseButton() { UpdateData(TRUE); - EndDialog(CFeedbackHandler::eResult_Pause); + EndDialog(chcore::EFeedbackResult::eResult_Pause); } void CFeedbackFileErrorDlg::OnBnClickedCancel() { UpdateData(TRUE); - EndDialog(CFeedbackHandler::eResult_Cancel); + EndDialog(chcore::EFeedbackResult::eResult_Cancel); }