本文整理汇总了C++中CStockInfo::GetStockName方法的典型用法代码示例。如果您正苦于以下问题:C++ CStockInfo::GetStockName方法的具体用法?C++ CStockInfo::GetStockName怎么用?C++ CStockInfo::GetStockName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CStockInfo
的用法示例。
在下文中一共展示了CStockInfo::GetStockName方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: OnUpdate
void CBaseView::OnUpdate(CView* pSender, LPARAM lHint, CObject* pHint)
{
// TODO: Add your specialized code here and/or call the base class
if( UPDATE_HINT_BASEVIEW != lHint )
return;
if( IsWindowVisible() )
SetFocus( );
CStockInfo info;
if( !AfxGetProfile().GetCurrentStock( &info ) )
return;
CString strHeader = info.GetStockCode();
strHeader += " ";
strHeader += info.GetStockName();
strHeader += "\r\n\r\n ";
GetEditCtrl().SetWindowText( strHeader );
GetEditCtrl().SetSel( strHeader.GetLength()-1, strHeader.GetLength()-1 );
m_stock.Clear( );
m_stock.SetStockInfo( &info );
m_stock.SetDatabase( &AfxGetDB() );
m_stock.PrepareBaseInfo( TRUE );
char * pText = m_stock.GetBaseTextPtr();
int nLength = m_stock.GetBaseTextLength();
if( pText && nLength > 0 )
{
GetEditCtrl().ReplaceSel( pText );
}
else
{
CString strNoBaseData;
strNoBaseData.LoadString( IDS_BASEVIEW_NOBASEDATA );
GetEditCtrl().ReplaceSel( strNoBaseData );
}
GetEditCtrl().SetSel( 0, 0 );
AfxGetStkReceiver().RequestStockData( CStock::dataBasetext, &info, 1, 0, 0 );
}
示例2: OnStart
void CTyDataDlg::OnStart()
{
UpdateData( );
StoreProfile();
if( m_tmBegin > m_tmEnd )
{
AfxMessageBox( IDS_TYDATADLG_ERRORTIME, MB_OK|MB_ICONINFORMATION );
return;
}
if( 0 == access(m_strFileDest,0)
&& IDNO == AfxMessageBox(IDS_TYDATADLG_OVERWRITE,MB_YESNO) )
return;
CFile file;
if( !file.Open( m_strFileDest, CFile::modeCreate | CFile::modeWrite ) )
{
AfxMessageBox( IDS_TYDATADLG_ERRORCREATEFILE, MB_OK|MB_ICONINFORMATION );
return;
}
file.Close();
m_btnStart.EnableWindow( FALSE );
int nFileCountTotal = CNetDatabase::GetFileCount( m_strPathSrcSH, FALSE )
+ CNetDatabase::GetFileCount( m_strPathSrcSZ, FALSE );
int nFileCount = 0, nCount = 0, nProgress = 0;
m_ctrlProgress.SetWindowPos( NULL, 0, 0, 0, 0, SWP_SHOWWINDOW | SWP_NOSIZE | SWP_NOMOVE );
m_ctrlProgress.SetRange( 0, nFileCountTotal );
m_ctrlProgress.SetPos( 0 );
CFileFind finder;
// ÉϺ£
BOOL bWorking = finder.FindFile( AfxGetFilePath( (LPCTSTR)m_strPathSrcSH, LPCTSTR("*.day") ) );
while( bWorking )
{
bWorking = finder.FindNextFile();
CString sKFile = finder.GetFilePath();
CString sCode = AfxGetFileTitleNoExt(sKFile);
CString sName;
CStockInfo info;
if( AfxGetStockContainer().GetStockInfo( sCode, &info ) )
sName = info.GetStockName();
int nRet = CStDatabase::AppendToTyData( sCode, sName, CKData::ktypeDay, sKFile,
m_strFileDest, m_tmBegin.GetTime(), m_tmEnd.GetTime() );
nCount += nRet;
if( nRet > 0 ) nFileCount ++;
// Progress
m_ctrlProgress.SetPos(++nProgress);
CString strProgressNew;
if( nFileCountTotal > 0 )
strProgressNew.Format( "%d%%", 100*nProgress/nFileCountTotal );
CString strProgressOld;
m_staticProgress.GetWindowText( strProgressOld );
if( 0 != strProgressNew.Compare( strProgressOld ) )
m_staticProgress.SetWindowText( strProgressNew );
}
finder.Close();
// ÉîÛÚ
bWorking = finder.FindFile( AfxGetFilePath( (LPCTSTR)m_strPathSrcSZ, LPCTSTR("*.day") ) );
while( bWorking )
{
bWorking = finder.FindNextFile();
CString sKFile = finder.GetFilePath();
CString sCode = AfxGetFileTitleNoExt(sKFile);
CString sName;
CStockInfo info;
if( AfxGetStockContainer().GetStockInfo( sCode, &info ) )
sName = info.GetStockName();
int nRet = CStDatabase::AppendToTyData( sCode, sName, CKData::ktypeDay, sKFile,
m_strFileDest, m_tmBegin.GetTime(), m_tmEnd.GetTime() );
nCount += nRet;
if( nRet > 0 ) nFileCount ++;
// Progress
m_ctrlProgress.SetPos(++nProgress);
CString strProgressNew;
if( nFileCountTotal > 0 )
strProgressNew.Format( "%.2f%%", 100.*nProgress/nFileCountTotal );
CString strProgressOld;
m_staticProgress.GetWindowText( strProgressOld );
if( 0 != strProgressNew.Compare( strProgressOld ) )
m_staticProgress.SetWindowText( strProgressNew );
}
finder.Close();
CString strReportFmt, strReport;
strReportFmt.LoadString( IDS_TYDATADLG_REPORTFMT );
strReport.Format( strReportFmt, nFileCount, nCount );
AfxMessageBox( strReport, MB_OK|MB_ICONINFORMATION );
m_btnStart.EnableWindow( TRUE );
//.........这里部分代码省略.........
示例3: DrawMultiSort
void CMultiSort::DrawMultiSort( CDC * pDC, MULTISORT &ms, CRect rect, UINT nSLH, int nSelectPos )
{
DECLARE_COLOR_DEFINATION
int x = rect.left+8;
int x2 = (int)( rect.left+0.56*rect.Width() );
int x3 = rect.right-8;
int y = rect.top+20;
int yStep = (rect.Height()-23) / 6 ;
if( yStep <= 0 )
return;
CFont * pOldFont = AfxSelectDCFont( pDC, 14 );
pDC->SetBkColor( clrBK );
int size = sizeof(m_msRise.m_stocks)/sizeof(m_msRise.m_stocks[0]);
for( int i=0; i<size; i++ )
{
CStockInfo info;
char buf_code[sizeof(ms.m_stocks[i].m_code)+1];
memset( buf_code, 0, sizeof(buf_code) );
memcpy( buf_code, ms.m_stocks[i].m_code, sizeof(ms.m_stocks[i].m_code) );
if( !AfxGetStockContainer().GetStockInfo(buf_code, &info) )
continue;
info.m_fClose = float(0.001*ms.m_stocks[i].m_data1);
pDC->SetTextColor( clrText );
//#ifdef CLKLAN_ENGLISH_US
// pDC->TextOut( x, y, info.GetStockCode() );
//#else
pDC->TextOut( x, y, info.GetStockName() );
//#endif
UINT nOldAlign = pDC->SetTextAlign( TA_RIGHT | TA_TOP );
pDC->SetTextColor( AfxGetVariantColor(SLH_CLOSE,info) );
pDC->TextOut( x2, y, (LPCTSTR)AfxGetVariantDispString(SLH_CLOSE,info,NULL) );
CString strTemp;
if( CStock::classVolRatio == ms.m_class )
strTemp.Format( "%.2f", 0.01*ms.m_stocks[i].m_data2 );
else if( CStock::classAmount == ms.m_class )
strTemp.Format( "%.0f", 0.001*ms.m_stocks[i].m_data2 );
else
strTemp.Format( "%.2f%%", 0.01*ms.m_stocks[i].m_data2 );
pDC->TextOut( x3, y, strTemp );
y += yStep;
pDC->SetTextAlign( nOldAlign );
// 选中股票
if( nSelectPos == i )
{
int ySel = y-yStep+16;
if( ySel > rect.top && ySel < rect.bottom )
DrawLine( pDC, 2, clrBorder, rect.left+5, ySel, rect.right-5, ySel );
}
}
// 补足股票排名
for( i=size; i<6; i++ )
{
pDC->SetTextColor( clrText );
pDC->TextOut( x, y, "-" );
UINT nOldAlign = pDC->SetTextAlign( TA_RIGHT | TA_TOP );
pDC->TextOut( x2, y, "-" );
pDC->TextOut( x3, y, "-" );
y += yStep;
pDC->SetTextAlign( nOldAlign );
}
pDC->SelectObject( pOldFont );
}
示例4: InitStocks
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;
}