From 2492bcef324590e5624a7067fe498a69433dead2 Mon Sep 17 00:00:00 2001 From: Frank Li Date: Thu, 27 Nov 2008 22:14:40 +0800 Subject: [PATCH] Workaround Show Message Problem --- TortoiseProc/CommitDlg.cpp | 22 +++++++++++----------- Utils/MiscUI/MessageBox.cpp | 14 +++++++++++++- 2 files changed, 24 insertions(+), 12 deletions(-) diff --git a/TortoiseProc/CommitDlg.cpp b/TortoiseProc/CommitDlg.cpp index 4ba1d6a..8bd02b2 100644 --- a/TortoiseProc/CommitDlg.cpp +++ b/TortoiseProc/CommitDlg.cpp @@ -421,21 +421,21 @@ void CCommitDlg::OnOK() { cmd.Format(_T("git.cmd update-index -- %s"),checkedfiles); g_Git.Run(cmd,&out); - } - CString tempfile=::GetTempFile(); - CStdioFile file(tempfile,CFile::modeReadWrite|CFile::modeCreate ); - file.WriteString(m_sLogMessage); - file.Close(); + CString tempfile=::GetTempFile(); + CStdioFile file(tempfile,CFile::modeReadWrite|CFile::modeCreate ); + file.WriteString(m_sLogMessage); + file.Close(); - out =_T(""); - cmd.Format(_T("git.cmd commit -F \"%s\""), tempfile); - g_Git.Run(cmd,&out); + out =_T(""); + cmd.Format(_T("git.cmd commit -F \"%s\""), tempfile); + g_Git.Run(cmd,&out); - CFile::Remove(tempfile); - - CMessageBox::Show(this->m_hWnd, out, _T("Commit Finish"), MB_YESNO | MB_ICONINFORMATION); + CFile::Remove(tempfile); + CMessageBox::Show(this->m_hWnd, out, _T("Commit Finish"), MB_YESNO | MB_ICONINFORMATION); + }else + CMessageBox::Show(this->m_hWnd, _T("Nothing Commit"), _T("Commit Finish"), MB_YESNO | MB_ICONINFORMATION); #if 0 if (m_pathwatcher.GetNumberOfChangedPaths() && m_bRecursive) { diff --git a/Utils/MiscUI/MessageBox.cpp b/Utils/MiscUI/MessageBox.cpp index 6a086cc..8a5c73d 100644 --- a/Utils/MiscUI/MessageBox.cpp +++ b/Utils/MiscUI/MessageBox.cpp @@ -431,8 +431,20 @@ int CMessageBox::FillBoxStandard(UINT uType) UINT CMessageBox::GoModal(CWnd * pWnd, const CString& title, const CString& msg, int nDefaultButton) { NONCLIENTMETRICS ncm; + memset(&ncm,0,sizeof(NONCLIENTMETRICS)); ncm.cbSize = sizeof(NONCLIENTMETRICS); - VERIFY(SystemParametersInfo(SPI_GETNONCLIENTMETRICS, sizeof(NONCLIENTMETRICS), &ncm, 0)); + SystemParametersInfo(SPI_GETNONCLIENTMETRICS, sizeof(NONCLIENTMETRICS), &ncm, 0); + DWORD nErrorNo = GetLastError ( ); // µÃµ½´íÎó´úÂë + LPSTR lpBuffer; + FormatMessage ( FORMAT_MESSAGE_ALLOCATE_BUFFER | + FORMAT_MESSAGE_IGNORE_INSERTS | + FORMAT_MESSAGE_FROM_SYSTEM, + NULL, + nErrorNo, // ´ËÄË´íÎó´úÂ룬ͨ³£ÔÚ³ÌÐòÖпÉÓÉ GetLastError()µÃÖ® + LANG_NEUTRAL, + (LPTSTR) & lpBuffer, + 0 , + NULL ); memcpy(&m_LogFont, &(ncm.lfMessageFont), sizeof(LOGFONT)); //the problem with the LOGFONT lfHeight is that it is not in pixels, -- 2.11.0