本文整理汇总了C++中CString::FormatMessage方法的典型用法代码示例。如果您正苦于以下问题:C++ CString::FormatMessage方法的具体用法?C++ CString::FormatMessage怎么用?C++ CString::FormatMessage使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CString
的用法示例。
在下文中一共展示了CString::FormatMessage方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SaveGeneral
BOOL CSettingGitRemote::SaveGeneral(CString key, CString value)
{
if (value.IsEmpty())
{
// don't check result code. it fails if the entry not exist
g_Git.UnsetConfigValue(key, CONFIG_LOCAL);
if (!g_Git.GetConfigValue(key).IsEmpty())
{
CString msg;
msg.FormatMessage(IDS_PROC_SAVECONFIGFAILED, static_cast<LPCTSTR>(key), static_cast<LPCTSTR>(value));
CMessageBox::Show(GetSafeHwnd(), msg, L"TortoiseGit", MB_OK | MB_ICONERROR);
return FALSE;
}
return TRUE;
}
if (g_Git.SetConfigValue(key, value, CONFIG_LOCAL))
{
CString msg;
msg.FormatMessage(IDS_PROC_SAVECONFIGFAILED, static_cast<LPCTSTR>(key), static_cast<LPCTSTR>(value));
CMessageBox::Show(GetSafeHwnd(), msg, L"TortoiseGit", MB_OK | MB_ICONERROR);
return FALSE;
}
return TRUE;
}
示例2: if
LRESULT CForceSyncDlg::OnP4Diff(WPARAM wParam, LPARAM lParam)
{
CCmd_Diff *pCmd= (CCmd_Diff *) wParam;
if(!pCmd->GetError())
{
int cnt;
if ((cnt = pCmd->GetDiffRunCount()) == 0)
{
if (pCmd->GetDiffNbrFiles() == 1)
{
CString msg;
msg.FormatMessage(IDS_CLIENT_FILE_s_DOES_NOT_DIFFER_FROM_DEPOT_FILE,
pCmd->GetDiffFileName());
AddToStatus(msg, SV_COMPLETION);
}
else if (pCmd->GetDiffErrCount() == 0)
AddToStatus(LoadStringResource(IDS_NONE_OF_THE_SELECTED_CLIENT_FILES_DIFFER), SV_COMPLETION);
}
else if (cnt < pCmd->GetDiffNbrFiles())
{
CString txt;
int i = pCmd->GetDiffNbrFiles() - cnt;
if(i == 1)
txt.FormatMessage(IDS_ONECLIENTFILEDOESNOTDIFFER);
else
txt.FormatMessage(IDS_SEVERALCLIENTFILESDONOTDIFFER_n, i);
AddToStatus(txt, SV_COMPLETION);
}
}
delete pCmd;
MainFrame()->ClearStatus();
return 0;
}
示例3: nameByAction
CString CP4FileStats::GetFormattedChangeFile(BOOL showFileType, BOOL showOpenAction) const
{
// Format name + haveRev+headRev for display
CString temp;
int openAction= m_MyOpenAction;
if(showOpenAction && m_OtherOpens && !m_MyOpenAction)
{
openAction= m_OtherOpenAction;
}
if(showFileType)
{
CString type = (m_Type == _T("unknown")) ? m_HeadType : m_Type;
if(showOpenAction)
temp.FormatMessage(IDS_FSTAT_s_n_s_s, m_DepotPath, m_HaveRev,
type, nameByAction((FileAction)openAction));
else
temp.FormatMessage(IDS_FSTAT_s_n_s, m_DepotPath, m_HaveRev, type);
}
else
{
if(showOpenAction)
temp.FormatMessage(IDS_FSTAT_s_n_s, m_DepotPath, m_HaveRev, nameByAction((FileAction)openAction));
else
temp.FormatMessage(IDS_FSTAT_s_n, m_DepotPath, m_HaveRev);
}
return temp;
}
示例4: GetName
CString CNBLogicalDevice::GetName()
{
ATLASSERT(m_mapUnitDevices.size());
CString strText;
if(0 == m_mapUnitDevices.size())
{
strText.FormatMessage(IDS_LOGDEV_TYPE_UNKNOWN_FMT, NMT_INVALID);
}
else if(IsGroup())
{
strText = GetRaidStatusString();
switch(GetType()) {
case NMT_AGGREGATE: strText.LoadString(IDS_LOGDEV_TYPE_AGGREGATED_DISK); break;
case NMT_MIRROR: strText.LoadString(IDS_LOGDEV_TYPE_MIRRORED_DISK); break;
case NMT_RAID0: strText.LoadString(IDS_LOGDEV_TYPE_DISK_RAID0); break;
case NMT_RAID1: strText.LoadString(IDS_LOGDEV_TYPE_DISK_RAID1); break;
case NMT_RAID1R2: strText.LoadString(IDS_LOGDEV_TYPE_DISK_RAID1R2); break;
case NMT_RAID1R3: strText.LoadString(IDS_LOGDEV_TYPE_DISK_RAID1R3); break;
case NMT_RAID4: strText.LoadString(IDS_LOGDEV_TYPE_DISK_RAID4); break;
case NMT_RAID4R2: strText.LoadString(IDS_LOGDEV_TYPE_DISK_RAID4R2); break;
case NMT_RAID4R3: strText.LoadString(IDS_LOGDEV_TYPE_DISK_RAID4R3); break;
default: strText.FormatMessage(IDS_LOGDEV_TYPE_UNKNOWN_FMT, GetType());
}
}
else
{
ATLASSERT(1 == m_mapUnitDevices.size() && m_mapUnitDevices.count(0));
strText = m_mapUnitDevices[0]->GetName();
}
return strText;
}
示例5: ShowMessage
void ShowMessage(int headerId, int bodyId, int footerId, HRESULT hr)
{
HWND hwndExcel = FindCurrentExcelWindow();
try
{
CString addInFullPath = AddInFullPath();
CPath addInFileName = addInFullPath;
addInFileName.StripPath();
CString msgTitle;
msgTitle.FormatMessage(IDS_MSG_TITLE, addInFileName);
CString header;
header.LoadString(headerId);
CString body;
body.LoadString(bodyId);
CString footer;
footer.LoadString(footerId);
CString hresult = "";
if (hr != S_OK)
{
hresult.FormatMessage(IDS_MSG_HRESULT, hr);
}
CString msg;
msg.FormatMessage(IDS_MSG_TEMPLATE, header, body, footer, hresult, addInFullPath);
MessageBox(hwndExcel, msg, msgTitle, MB_ICONEXCLAMATION);
}
catch (...)
{
ShowMessageError(hwndExcel);
}
}
示例6: ShowUnifiedDiff
bool SVNDiff::ShowUnifiedDiff(const CTSVNPath& url1, const SVNRev& rev1,
const CTSVNPath& url2, const SVNRev& rev2,
SVNRev peg,
const CString& options,
bool bIgnoreAncestry /* = false */,
bool /*blame*/,
bool bIgnoreProperties /* = true */)
{
CTSVNPath tempfile;
if (UnifiedDiff(tempfile, url1, rev1, url2, rev2, peg, options, bIgnoreAncestry, bIgnoreProperties))
{
CString title;
CTSVNPathList list;
list.AddPath(url1);
list.AddPath(url2);
if (url1.IsEquivalentTo(url2))
title.FormatMessage(IDS_SVNDIFF_ONEURL, (LPCTSTR)rev1.ToString(), (LPCTSTR)rev2.ToString(), (LPCTSTR)url1.GetUIFileOrDirectoryName());
else
{
CTSVNPath root = list.GetCommonRoot();
CString u1 = url1.GetUIPathString().Mid(root.GetUIPathString().GetLength());
CString u2 = url2.GetUIPathString().Mid(root.GetUIPathString().GetLength());
title.FormatMessage(IDS_SVNDIFF_TWOURLS, (LPCTSTR)rev1.ToString(), (LPCTSTR)u1, (LPCTSTR)rev2.ToString(), (LPCTSTR)u2);
}
return !!CAppUtils::StartUnifiedDiffViewer(tempfile.GetWinPathString(), title);
}
return false;
}
示例7: if
CString CP4FileStats::GetFormattedFilename(BOOL showFileType) const
{
CString filename = GET_P4REGPTR( )->ShowEntireDepot( ) <= SDF_DEPOT
? GetDepotFilename() : GetClientFilename();
// Format name + haveRev+headRev for display
CString temp;
if(m_HeadAction == F_DELETE)
{
// If the user has the file at < headrev, let the user know
if( m_HaveRev > 0 && m_HaveRev < m_HeadRev )
temp.FormatMessage(IDS_FSTAT_s_n_n_s_HEAD_REV_DELETED, filename, m_HaveRev, m_HeadRev, m_HeadType);
else if(showFileType)
temp.FormatMessage(IDS_FSTAT_s_n_n_s_DELETED, filename, m_HaveRev, m_HeadRev, m_HeadType);
else
temp.FormatMessage(IDS_FSTAT_s_n_n_DELETED, filename, m_HaveRev, m_HeadRev);
}
else
{
if (!m_HeadRev && !m_HaveRev)
temp = filename;
else if(showFileType)
temp.FormatMessage(IDS_FSTAT_s_n_n_s, filename, m_HaveRev, m_HeadRev, m_HeadType);
else
temp.FormatMessage(IDS_FSTAT_s_n_n, filename, m_HaveRev, m_HeadRev);
}
return temp;
}
示例8: SetRedraw
LRESULT CClientListCtrl::OnP4ClientList(WPARAM wParam, LPARAM lParam)
{
CCmd_Clients *pCmd= (CCmd_Clients *) wParam;
if(!pCmd->GetError())
{
CString msg;
CObList const *clients= pCmd->GetList();
int count = clients->GetCount();
SetRedraw(FALSE);
int index = 0;
CString curclient = GET_P4REGPTR()->GetP4Client();
CString defclient = GET_P4REGPTR()->GetP4Client(TRUE);
CString user = GET_P4REGPTR()->GetP4User();
for(int subItem=0; subItem < CLIENT_MAXCOL; subItem++)
m_ListAll.column[subItem].SetSize(clients->GetCount(), 100);
for(POSITION pos= clients->GetHeadPosition(); pos != NULL; index++)
{
CP4Client *client=(CP4Client *) clients->GetNext(pos);
InsertClient(client, index, &curclient, &defclient, &user);
if ((index & 0x1FFF) == 0)
{
msg.FormatMessage(IDS_INSERTING_CLIENTS, count - index);
MainFrame()->UpdateStatus(msg);
}
}
SetRedraw(TRUE);
msg.FormatMessage( IDS_NUMBER_OF_CLIENTS_n, index );
AddToStatus( msg, SV_COMPLETION );
ReSort();
// Make sure previous item is re-selected
if(clients->GetCount() > 0)
{
int i = FindInList(m_Active.IsEmpty() ? GET_P4REGPTR()->GetP4Client() : m_Active);
if (i < 0) i=0;
SetItemState(i, LVIS_SELECTED|LVIS_FOCUSED, LVIS_SELECTED|LVIS_FOCUSED);
EnsureVisible(i, FALSE);
}
CP4ListCtrl::SetUpdateDone();
// Notify the mainframe that we have finished getting the clients,
// hence the entire set of async command have finished.
MainFrame()->ExpandDepotIfNeedBe();
if (m_PostViewUpdateMsg)
PostMessage(m_PostViewUpdateMsg, m_PostViewUpdateWParam, m_PostViewUpdateLParam);
}
else
CP4ListCtrl::SetUpdateFailed();
delete pCmd;
m_PostViewUpdateMsg = 0;
MainFrame()->ClearStatus();
return 0;
}
示例9: VerifyOKToContinue
UINT CAddListDlg::VerifyOKToContinue()
{
CString warning;
if(m_AddFileCount == m_WarnLimit)
warning.FormatMessage(IDS_THIS_FILE_ADD_OPERATION_HAS_ALREADY_FOUND_OVER_n, m_AddFileCount);
else
warning.FormatMessage(IDS_THIS_FILE_ADD_OPERATION_HAS_NOW_ADDED_n, m_AddFileCount);
return AfxMessageBox(warning, MB_YESNO|MB_ICONEXCLAMATION);
}
示例10: ExpandRelativeTime
/**
* Passed a value and two resource string ids
* if count is 1 then FormatString is called with format_1 and the value
* otherwise format_2 is used
* the formatted string is returned
*/
CString CLoglistUtils::ExpandRelativeTime(int count, UINT format_1, UINT format_n)
{
CString answer;
if (count == 1)
answer.FormatMessage(format_1, count);
else
answer.FormatMessage(format_n, count);
return answer;
}
示例11: OnUserCreatenewuser
void CUserListCtrl::OnUserCreatenewuser()
{
if (m_EditInProgress)
{
CantEditRightNow(IDS_USER);
return;
}
MainFrame()->ViewUsers();
m_olduser = GET_P4REGPTR()->GetP4User( );
// let user type in the new name. if it's blank the user bailed.
//
CNewClientDlg newdlg;
newdlg.SetNew( NEWUSER );
if (FindInList(m_Active) != -1)
newdlg.m_Active = m_Active;
if( newdlg.DoModal( ) == IDCANCEL )
return;
CString saveActive = m_Active;
m_Active = newdlg.GetName( ) ;
if ( m_Active.IsEmpty( ) )
{
m_Active = saveActive;
return;
}
if (FindInListNoCase(m_Active) != -1)
{
CString msg;
UINT nType;
if (FindInList(m_Active) != -1)
{
msg.FormatMessage ( IDS_USER_s_ALREADY_EXIST, m_Active );
nType = MB_OK;
}
else
{
msg.FormatMessage ( IDS_USER_s_DIFFCASE_EXIST, m_Active );
nType = MB_YESNO;
}
if (IDYES != AfxMessageBox( msg, nType ))
{
m_Active = saveActive;
return;
}
}
if ( SetP4User( ) )
OnEditSpec( m_Active, TRUE );
}
示例12: ExpandRelativeTime
/**
* Passed a value and two resource string ids
* if count is 1 then FormatString is called with format_1 and the value
* otherwise format_2 is used
* the formatted string is returned
*/
CString CAppUtils::ExpandRelativeTime( int count, UINT format_1, UINT format_n )
{
CString answer;
if ( count == 1 )
{
answer.FormatMessage( format_1, count );
}
else
{
answer.FormatMessage( format_n, count );
}
return answer;
}
示例13: UpdateTitleBarText
void CBaseDialog::UpdateTitleBarText(_In_opt_z_ LPCTSTR szMsg)
{
CString szTitle;
if (szMsg)
{
szTitle.FormatMessage(IDS_TITLEBARMESSAGE, (LPCTSTR)m_szTitle, szMsg);
}
else
{
szTitle.FormatMessage(IDS_TITLEBARPLAIN, (LPCTSTR)m_szTitle);
}
// set the title bar
SetWindowText(szTitle);
} // CBaseDialog::UpdateTitleBarText
示例14: OnComError
void CCopyDlg::OnComError( HRESULT hr )
{
COMError ce(hr);
CString sErr;
sErr.FormatMessage(IDS_ERR_FAILEDISSUETRACKERCOM, m_bugtraq_association.GetProviderName(), ce.GetMessageAndDescription().c_str());
::MessageBox(m_hWnd, sErr, L"TortoiseSVN", MB_ICONERROR);
}
示例15: SaveImage
ERMsg CDib::SaveImage(const CString& filePath, REFGUID guidFileType, int bpp)const
{
ASSERT( guidFileType != GUID_NULL || !UtilWin::GetFileExtension(filePath).IsEmpty() );
ERMsg message;
if( bpp == -1)
{
bpp = GetBPP();
}
else if( bpp != GetBPP())
{
CDib dib;
dib.Copy( *this, bpp);
return dib.SaveImage(filePath, guidFileType);
}
if( FAILED(Save(filePath, guidFileType)))
{
CString error;
error.FormatMessage(IDS_BSC_UNABLE_OPEN_WRITE, filePath );
message.ajoute( UtilWin::ToUTF8(error) );
}
return message;
}