/** * @param eNumFormat - numeric format. */ void CNumEdit::SetNumFormat(NUM_FORMAT eNumFormat) { if (m_eNumFormat == eNumFormat) return; if (m_hWnd == NULL) { m_eNumFormat = eNumFormat; return; } TCHAR szValue[64]; GetWindowText(szValue, countof(szValue)); if (*szValue) { switch (m_eNumFormat) { case NF_HEX: { UINT64 uValue = _tcstoui64(szValue, NULL, 16); _ui64tot_s(uValue, szValue, countof(szValue), 10); } break; case NF_DEC: { bool bNegative = false; for (int i = 0; ; ++i) { if (szValue[i] != _T(' ')) { if (szValue[i] == _T('-')) bNegative = true; break; } } if (bNegative) { INT64 iValue = _tcstoi64(szValue, NULL, 10); _i64tot_s(iValue, szValue, countof(szValue), 16); } else { UINT64 uValue = _tcstoui64(szValue, NULL, 10); _ui64tot_s(uValue, szValue, countof(szValue), 16); } } break; default: *szValue = _T('\0'); } SetValue(szValue, countof(szValue)); } m_eNumFormat = eNumFormat; UpdateRadixTitle(); }
CString CLogCacheStatisticsDlg::ToString (__int64 value) { TCHAR buffer[20] = { 0 }; _i64tot_s (value, buffer, _countof (buffer), 10); return buffer; }
/** * @param iValue - new field value. */ void CNumEdit::SetValue(INT64 iValue) { TCHAR szValue[64]; _i64tot_s(iValue, szValue, countof(szValue), m_eNumFormat); SetValue(szValue, countof(szValue)); }
bool Int64ToString(LONGLONG Value,LPTSTR pszString,int MaxLength,int Radix) { return _i64tot_s(Value,pszString,MaxLength,Radix)==0; }