int CStkUIApp::OpenDefaultStrategy( ) { CSPStringArray astrStrategyToOpen; // Recent if( m_pRecentFileList ) { for( int i=m_pRecentFileList->GetSize()-1; i>=0; i-- ) { CString strPath = (*m_pRecentFileList)[i]; if( !strPath.IsEmpty() ) astrStrategyToOpen.Add( strPath ); } } // projects CString strExt = AfxGetStrategyFileExt( ); if( !strExt.IsEmpty()) { CFileFind finder; BOOL bWorking = finder.FindFile( AfxGetFilePath( (LPCTSTR)AfxGetProfile().GetProjectPath(), LPCTSTR("*" + strExt) ) ); while( bWorking ) { bWorking = finder.FindNextFile(); CString strPath = finder.GetFilePath(); int i; for( i=0; i<astrStrategyToOpen.GetSize(); i++ ) { if( 0 == strPath.Compare( astrStrategyToOpen.ElementAt(i) ) ) break; } if( i == astrStrategyToOpen.GetSize() ) astrStrategyToOpen.Add( strPath ); } finder.Close(); } AfxGetProfile().SetLastOpenedStrategy( astrStrategyToOpen ); return OpenLastOpenedStrategy( ); }
BOOL CStockContainer::RetrieveSpecify( CSPStringArray & astr ) { CSPMutex::Scoped l(m_mutex); SetSize( 0, astr.GetSize() ); int nCount = 0; for( int i=0; i<astr.GetSize(); i++ ) { CSPString string = astr.ElementAt(i); CStockInfo info; if( AfxGetStockContainer().GetStockInfo( string, &info ) ) { Add( info ); nCount ++; } } SetSize( nCount ); return TRUE; }
BOOL CDomainContainer::AddDomainStock( LPCTSTR lpszDomainName, CSPStringArray & astr ) { if( NULL == lpszDomainName || strlen(lpszDomainName) < 0 ) return FALSE; for( int i=0; i<GetSize(); i++ ) { CDomain & domain = ElementAt(i); if( 0 == domain.m_strName.CompareNoCase( lpszDomainName ) ) { for( int j=0; j<astr.GetSize(); j++ ) domain.AddStock( astr.ElementAt(j) ); return TRUE; } } return FALSE; }
BOOL CSearchBox::InitStocks( CSPStringArray & astocks, BOOL bHasSTTTech, BOOL bShowOnSel, BOOL bDuplicate ) { ResetContent( ); m_bShowOnSel = bShowOnSel; CStockContainer & container = AfxGetStockContainer(); InitStorage( bDuplicate ? astocks.GetSize()*2 : astocks.GetSize(), 32 ); for( int i=0; i<astocks.GetSize(); i++ ) { if( astocks.ElementAt(i).GetLength() <= 0 ) continue; CStockInfo info; int nAID = -1; if( !container.GetStockInfo( astocks.ElementAt(i), &info, &nAID ) ) continue; CString strTemp = info.GetStockCode(); while( strTemp.GetLength() < 8 ) strTemp += ' '; strTemp += info.GetStockName(); int nItem = AddString( strTemp ); SetItemData( nItem, nAID ); if( bDuplicate ) { strTemp = info.GetStockShortName(); while( strTemp.GetLength() < 8 ) strTemp += ' '; strTemp += info.GetStockName(); if( CB_ERR == SelectString( 0, strTemp ) ) { nItem = AddString( strTemp ); SetItemData( nItem, nAID ); } } } if( bHasSTTTech ) { // 技术指标项 UINT nTechUserCount = CTechUser::GetTechUserCount(); for( UINT i=STT_MIN; i <= STT_MAX+nTechUserCount; i ++ ) { UINT nTech = i; if( nTech > STT_MAX ) nTech = i-STT_MAX-1+STT_USER_MIN; CString strTemp = AfxGetSTTShortName( nTech ); while( strTemp.GetLength() < 8 ) strTemp += ' '; strTemp += AfxGetSTTName( nTech ); int nItem = AddString( strTemp ); SetItemData( nItem, nTech | SEARCHBOX_SIGNBIT_STT ); } // 快捷键项 for( UINT i = ACCE_MIN; i <= ACCE_MAX; i++ ) { CString strTemp = AfxGetAccelerator( i, 8 ); SetItemData( AddString(strTemp), i | SEARCHBOX_SIGNBIT_ACCE ); } } return TRUE; }