コード例 #1
0
ファイル: ExtLabel.cpp プロジェクト: OmerMor/SCICompanion-1
CExtSafeString CExtAviLabel::OnAviGenTempFileName()
{
	ASSERT_VALID( this );
TCHAR lpTempPathBuffer[MAX_PATH];
UINT uRetVal = 0;
CExtSafeString strRetVal;
	::GetTempPath( MAX_PATH, lpTempPathBuffer );
    uRetVal = ::GetTempFileName( lpTempPathBuffer, _T("AVI"), 0, strRetVal.GetBuffer( MAX_PATH ) );
	strRetVal.ReleaseBuffer();
    if( uRetVal == 0 )
		strRetVal.Empty();
	return strRetVal;
}
コード例 #2
0
ファイル: Propbar.cpp プロジェクト: aolko/construct
void CExtGridCellNumberEx::TextGet( CExtSafeString & strCopy ) const
{
	ASSERT_VALID( this );
	if(		(GetStyleEx()&__EGCS_EX_UNDEFINED_ROLE) != 0 
		||	IsEmpty()
		)
	{
		strCopy = _T("");
		return;
	}
	strCopy.Empty();

VARIANT varCopy;
	::VariantInit( &varCopy );
HRESULT hr = 
		::VariantCopy( 
			&varCopy, 
			LPVARIANT( LPCVARIANT( this ) )
			);
	if(		FAILED(hr)
		||	(!OnTextGetPrepareVariant( &varCopy ))
		)
	{
		ASSERT( FALSE );
		return;
	}

CExtSafeString sNumberText;
bool bRet = OnQueryNumberText( &varCopy, sNumberText );
	
	::VariantClear( &varCopy );
	
	if( !bRet )
		return;

	UINT nNumDigits = OnQueryNumDigits();
//    if( ! OnQueryTrailingZeroes() )
    {
        INT nPosPoint = sNumberText.ReverseFind( _T('.') );
        UINT nNumDigitsReal = 0;
        if( nPosPoint >= 0 )
            nNumDigitsReal = min( sNumberText.GetLength() - 1 - nPosPoint, 9 );
        if( nNumDigitsReal < nNumDigits )
            nNumDigits = nNumDigitsReal;
    }


NUMBERFMT fmt;
	memset( &fmt, 0, sizeof(NUMBERFMT) );

	fmt.NumDigits = nNumDigits;
	fmt.LeadingZero = OnQueryLeadingZero();
	fmt.NegativeOrder = OnQueryNegativeOrder();

CExtSafeString sGrouping;
	OnQueryGrouping( sGrouping );
	sGrouping.Remove( _T(';') );
	sGrouping.TrimRight( _T('0') );
	fmt.Grouping = _ttoi( sGrouping );
	
CExtSafeString sDecimalSep;
	OnQueryDecimalSeparator( sDecimalSep );
	fmt.lpDecimalSep = sDecimalSep.GetBuffer( sDecimalSep.GetLength() );
	sDecimalSep.ReleaseBuffer();
	
CExtSafeString sThousandSep;
	OnQueryThousandSeparator( sThousandSep );
	fmt.lpThousandSep = sThousandSep.GetBuffer( sThousandSep.GetLength() );
	sThousandSep.ReleaseBuffer();

	VERIFY(
		g_ResourceManager->GetNumberFormat(
			  0,
			  sNumberText,
			  &fmt,
			  strCopy.GetBuffer( 100 ),
			  100
			) != 0
		);
	strCopy.ReleaseBuffer();
}