CSPString AfxGetFileDirectory( CSPString strPathName, CSPString strDefault ) { if( strPathName.IsEmpty() ) return strDefault; CSPString strResult = strPathName; if( strResult.GetLength() > 0 ) { int nIndex = strResult.ReverseFind( '\\' ); if( -1 == nIndex ) nIndex = strResult.ReverseFind( '/' ); if( -1 == nIndex ) strResult = strDefault; else strResult = strResult.Left( nIndex ); } if( strResult.GetLength() <= 0 ) return strDefault; int nLen = strResult.GetLength(); if( nLen > 0 && strResult[nLen-1] != '\\' && strResult[nLen-1] != '/' ) strResult += STRING_DIRSEP; return strResult; }
void CSListView::OnDblclkItem( int nStockIndex ) { CStockContainer & container = AfxGetSListStockContainer(); int nType; CSPString strDomain; DWORD dwDate = -1; if( nStockIndex >= 0 ) { container.GetCurrentType( &nType, &strDomain, &dwDate ); if( ( nType == CStockContainer::typeDomain && strDomain.IsEmpty() ) || ( nType == CStockContainer::typeGroup && strDomain.IsEmpty() ) ) { CStockInfo & info = container.GetStockInfoByID( nStockIndex ); AfxShowSlist( nType, CString(info.GetStockName()), dwDate ); } else AfxShowStockGraph( nStockIndex, TRUE ); } }
int CStkUIApp::OpenLastOpenedStrategy( ) { CSPStringArray & astrStrategyToOpen = AfxGetProfile().GetLastOpenedStrategy( ); CSPString strLastActive = AfxGetProfile().GetLastActiveStrategy( ); if( 0 != access(strLastActive,0) ) strLastActive.Empty(); int nCount = 0; for( int i=0; i<astrStrategyToOpen.GetSize(); i++ ) { if( 0 != access(astrStrategyToOpen.ElementAt(i),0) ) continue; if( NULL != OpenStrategyFile(astrStrategyToOpen.ElementAt(i)) ) { nCount ++; if( strLastActive.IsEmpty() ) strLastActive = astrStrategyToOpen.ElementAt(i); } } if( !strLastActive.IsEmpty() ) OpenStrategyFile(strLastActive); return nCount; }