Пример #1
0
/**
 * @param iValue - numeric value.
 */
void CNumEdit::GetValue(INT64& iValue)
{
	TCHAR szValue[64];
	GetWindowText(szValue, countof(szValue));
	switch (m_eNumFormat)
	{
	case NF_HEX:
		iValue = _tcstoi64(szValue, NULL, 16);
		break;
	case NF_DEC:
		iValue = _tcstoi64(szValue, NULL, 10);
		break;
	default:
		iValue = 0;
	}
}
Пример #2
0
/**
 * @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();
}
int64_t DateField::stringToTime(const TCHAR* time) {
	TCHAR* end;
	return _tcstoi64(time, &end, 36);
}
Пример #4
0
LONGLONG StringToInt64(LPCTSTR pszString)
{
	return _tcstoi64(pszString,nullptr,0);
}