void CStkUIApp::SaveLastOpenedStrategy( ) { CSPStringArray astr; POSITION pos = GetFirstStrategyPosition(); while(pos != NULL) { CStrategy* pStrategy = GetNextStrategy(pos); if( pStrategy ) astr.Add( pStrategy->GetPathName() ); } AfxGetProfile().SetLastOpenedStrategy( astr ); }
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 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; }
void CSListView::GetSelectedStocks( CSPStringArray & astr ) { CStockContainer & container = AfxGetSListStockContainer(); container.Lock(); int nTotalCount = m_Grid.GetSelectedCount(); astr.RemoveAll(); astr.SetSize( 0, nTotalCount > 10 ? nTotalCount : -1 ); for( int nRow=1; nRow<m_Grid.GetRowCount(); nRow++ ) { BOOL bSelected = FALSE; for( int nCol=0; nCol<m_Grid.GetColumnCount(); nCol ++ ) bSelected |= ( m_Grid.GetItemState(nRow,nCol) & GVIS_SELECTED ); if( !bSelected ) continue; LPARAM id = m_Grid.GetItemData(nRow,0); CStockInfo & info = container.GetStockInfoByID(id); astr.Add( info.GetStockCode() ); } container.UnLock(); }
BOOL CDomainContainer::GetDomainStocks( LPCTSTR lpszDomain, CSPStringArray &astr ) { if( NULL == lpszDomain || strlen(lpszDomain) < 0 ) return FALSE; for( int i=0; i<GetSize(); i++ ) { CDomain & domain = ElementAt(i); if( 0 == domain.m_strName.CompareNoCase( lpszDomain ) ) { astr.Copy( domain ); return TRUE; } } return FALSE; }
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( ); }
void AfxGetAllDistrict( CSPStringArray & astr ) { #ifdef CLKLAN_ENGLISH_US astr.SetSize( 0, 30 ); astr.Add( "Australia & NZ" ); astr.Add( "Argentina" ); astr.Add( "Brazil" ); astr.Add( "Canada" ); astr.Add( "China" ); astr.Add( "Denmark" ); astr.Add( "France" ); astr.Add( "Germany" ); astr.Add( "Hong Kong" ); astr.Add( "India" ); astr.Add( "Italy" ); astr.Add( "Japan" ); astr.Add( "Korea" ); astr.Add( "Mexico" ); astr.Add( "Norway" ); astr.Add( "Singapore" ); astr.Add( "Spain" ); astr.Add( "Sweden" ); astr.Add( "Taiwan" ); astr.Add( "UK & Ireland" ); astr.Add( "U.S." ); astr.Add( "Other" ); #else astr.SetSize( 0, 30 ); astr.Add( "澳大利亚" ); astr.Add( "阿根廷" ); astr.Add( "巴西" ); astr.Add( "加拿大" ); astr.Add( "中国" ); astr.Add( "丹麦" ); astr.Add( "法国" ); astr.Add( "德国" ); astr.Add( "中国香港" ); astr.Add( "印度" ); astr.Add( "意大利" ); astr.Add( "日本" ); astr.Add( "韩国" ); astr.Add( "墨西哥" ); astr.Add( "挪威" ); astr.Add( "新加坡" ); astr.Add( "西班牙" ); astr.Add( "瑞典" ); astr.Add( "中国台湾" ); astr.Add( "英国" ); astr.Add( "美国" ); astr.Add( "其他" ); #endif }
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; }