SelectorView.cpp
上传用户:zhanglf88
上传日期:2013-11-19
资源大小:6036k
文件大小:17k
源码类别:

金融证券系统

开发平台:

Visual C++

  1. // SelectorView.cpp : implementation of the CSelectorView class
  2. //
  3. #include "stdafx.h"
  4. #include "../StaticDoc.h"
  5. #include "SelectorView.h"
  6. #include "../Dialog/ListExportDlg.h"
  7. #ifdef _DEBUG
  8. #define new DEBUG_NEW
  9. #undef THIS_FILE
  10. static char THIS_FILE[] = __FILE__;
  11. #endif
  12. /////////////////////////////////////////////////////////////////////////////
  13. // CSelectorView
  14. IMPLEMENT_DYNCREATE(CSelectorView, CFormView)
  15. BEGIN_MESSAGE_MAP(CSelectorView, CFormView)
  16. //{{AFX_MSG_MAP(CSelectorView)
  17. ON_WM_CREATE()
  18. ON_WM_DESTROY()
  19. ON_WM_TIMER()
  20. ON_WM_ERASEBKGND()
  21. ON_WM_SIZE()
  22. ON_WM_SETFOCUS()
  23. ON_COMMAND(ID_FILE_PRINT, OnFilePrint)
  24. ON_UPDATE_COMMAND_UI(ID_FILE_PRINT, OnUpdateFilePrint)
  25. ON_BN_CLICKED(IDC_RUNSELECTOR, OnRunselector)
  26. ON_WM_CTLCOLOR()
  27. //}}AFX_MSG_MAP
  28. // Standard printing commands
  29. ON_COMMAND(ID_FILE_PRINT, CFormView::OnFilePrint)
  30. ON_COMMAND(ID_FILE_PRINT_DIRECT, CFormView::OnFilePrint)
  31. ON_COMMAND(ID_FILE_PRINT_PREVIEW, CFormView::OnFilePrintPreview)
  32. ON_MESSAGE(WM_USER_GETVIEWTITLE, OnGetViewTitle)
  33. ON_MESSAGE(WM_USER_GETVIEWCMDID, OnGetViewCmdid)
  34. ON_MESSAGE(WM_USER_CANCLOSEVIEW, OnCanCloseView)
  35. ON_MESSAGE(WM_USER_COLORCHANGE, OnColorChange)
  36. END_MESSAGE_MAP()
  37. /////////////////////////////////////////////////////////////////////////////
  38. // CSelectorView construction/destruction
  39. CSelectorView::CSelectorView()
  40. : CFormView(CSelectorView::IDD)
  41. {
  42. m_bShouldUpdate = FALSE;
  43. m_bRunning = FALSE;
  44. }
  45. CSelectorView::~CSelectorView()
  46. {
  47. }
  48. #define SELECTORVIEW_COLUMN_COUNT 6
  49. BOOL CSelectorView::InitializeGrid( )
  50. {
  51. // Create GridCtrl
  52. m_Grid.SetEditable(FALSE);
  53. m_Grid.SetListMode(TRUE);
  54. m_Grid.SetHeaderSort(FALSE);
  55. m_Grid.SetSingleRowSelection(FALSE);
  56. m_Grid.EnableDragAndDrop(TRUE);
  57. m_Grid.SetGridLines( GVL_NONE );
  58. m_Grid.EnableTitleTips( TRUE );
  59. m_Grid.SetRowResize( FALSE );
  60. m_Grid.SetColumnResize( TRUE );
  61. m_Grid.SetBkColor( AfxGetProfile().GetColor(CColorClass::clrSListBK) );
  62. m_Grid.SetTextBkColor( AfxGetProfile().GetColor(CColorClass::clrSListBK) );
  63. m_Grid.SetSelectedBkColor(AfxGetProfile().GetColor(CColorClass::clrSListSelected));
  64. TRY {
  65. m_Grid.SetRowCount(1);
  66. m_Grid.SetColumnCount(SELECTORVIEW_COLUMN_COUNT);
  67. m_Grid.SetFixedRowCount(1);
  68. m_Grid.SetFixedColumnCount(1);
  69. }
  70. CATCH (CMemoryException, e)
  71. {
  72. e->ReportError();
  73. e->Delete();
  74. return FALSE;
  75. }
  76. END_CATCH
  77. for( int nCol=0; nCol<m_Grid.GetColumnCount(); nCol++ )
  78. {
  79. m_Grid.SetItemBkColour( 0, nCol, AfxGetProfile().GetColor(CColorClass::clrSListBK) );
  80. m_Grid.SetItemFgColour( 0, nCol, AfxGetProfile().GetColor(CColorClass::clrTitle) );
  81. }
  82. CRect rectGrid;
  83. m_Grid.GetClientRect( &rectGrid );
  84. int nWidth = rectGrid.Width() / m_Grid.GetColumnCount() - 1;
  85. m_Grid.SetColumnWidth( 0, 70 );
  86. m_Grid.SetColumnWidth( 1, nWidth );
  87. m_Grid.SetColumnWidth( 2, 70 );
  88. m_Grid.SetColumnWidth( 3, 70 );
  89. m_Grid.SetColumnWidth( 4, nWidth + 30 );
  90. m_Grid.SetColumnWidth( 5, nWidth + 40 );
  91. // Set Column Header
  92. UINT idsHeader[SELECTORVIEW_COLUMN_COUNT] = {IDS_SELECTORVIEW_CODE, IDS_SELECTORVIEW_NAME,
  93. IDS_SELECTORVIEW_DATE, IDS_SELECTORVIEW_CLOSE, IDS_SELECTORVIEW_SIGNAL,
  94. IDS_SELECTORVIEW_DISCRIPT };
  95. for( nCol=0; nCol<SELECTORVIEW_COLUMN_COUNT; nCol++ )
  96. {
  97. GV_ITEM item;
  98. item.mask = GVIF_TEXT|GVIF_FORMAT;
  99. item.nFormat = DT_CENTER|DT_VCENTER|DT_SINGLELINE;
  100. item.row = 0;
  101. item.col = nCol;
  102. item.szText.LoadString( idsHeader[nCol] );
  103. m_Grid.SetItem(&item);
  104. }
  105. return TRUE;
  106. }
  107. void CSelectorView::SetFont( LPLOGFONT pLogFont )
  108. {
  109. ASSERT( pLogFont );
  110. HFONT hFont = ::CreateFontIndirect(pLogFont);
  111. m_Grid.SendMessage( WM_SETFONT, (WPARAM)hFont, MAKELPARAM(1, 0) );
  112. // m_Grid.AutoSize( );
  113. DeleteObject(hFont);
  114. }
  115. void CSelectorView::GetSelectedStocks( CSPStringArray & astr )
  116. {
  117. int nTotalCount = m_Grid.GetSelectedCount();
  118. astr.RemoveAll();
  119. astr.SetSize( 0, nTotalCount > 10 ? nTotalCount : -1 );
  120. for( int nRow=1; nRow<m_Grid.GetRowCount(); nRow++ )
  121. {
  122. BOOL bSelected = FALSE;
  123. for( int nCol=0; nCol<m_Grid.GetColumnCount(); nCol ++ )
  124. bSelected |= ( m_Grid.GetItemState(nRow,nCol) & GVIS_SELECTED );
  125. if( !bSelected )
  126. continue;
  127. LPARAM id = m_Grid.GetItemData(nRow,0);
  128. CStockInfo & info = m_container.GetStockInfoByID(id);
  129. astr.Add( info.GetStockCode() );
  130. }
  131. }
  132. void CSelectorView::OnDblclkItem( int nStockIndex )
  133. {
  134. if( nStockIndex >= 0 && nStockIndex < m_container.GetSize() )
  135. {
  136. CStockInfo & info = m_container.ElementAt(nStockIndex);
  137. AfxShowStockGraph( info.GetStockCode() );
  138. }
  139. }
  140. /////////////////////////////////////////////////////////////////////////////
  141. // CSelectorView overrides
  142. BOOL CSelectorView::Create(LPCTSTR lpszClassName, LPCTSTR lpszWindowName, DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID, CCreateContext* pContext) 
  143. {
  144. // TODO: Add your specialized code here and/or call the base class
  145. return CFormView::Create(lpszClassName, lpszWindowName, dwStyle, rect, pParentWnd, nID, pContext);
  146. }
  147. BOOL CSelectorView::OnCmdMsg(UINT nID, int nCode, void* pExtra, AFX_CMDHANDLERINFO* pHandlerInfo) 
  148. {
  149. // TODO: Add your specialized code here and/or call the base class
  150. if( ::IsWindow(m_Grid.GetSafeHwnd()) )
  151. if( m_Grid.OnCmdMsg(nID, nCode, pExtra, pHandlerInfo))
  152. return TRUE;
  153. return CFormView::OnCmdMsg(nID, nCode, pExtra, pHandlerInfo);
  154. }
  155. BOOL CSelectorView::PreTranslateMessage(MSG* pMsg) 
  156. {
  157. // TODO: Add your specialized code here and/or call the base class
  158. if( m_Grid.GetSafeHwnd() == pMsg->hwnd )
  159. {
  160. if( WM_LBUTTONDBLCLK == pMsg->message
  161. || ( WM_KEYDOWN == pMsg->message && VK_RETURN == pMsg->wParam ) )
  162. {
  163. int nColumnCount = m_Grid.GetColumnCount();
  164. int nRowCount = m_Grid.GetRowCount();
  165. if( nColumnCount <=0 || nRowCount <= 0 )
  166. return CFormView::PreTranslateMessage(pMsg);
  167. CRect rectCell;
  168. m_Grid.GetCellRect(0,0,&rectCell);
  169. CPoint pt = pMsg->pt;
  170. ::ScreenToClient( m_Grid.GetSafeHwnd(), &pt );
  171. if( pt.y >= rectCell.top && pt.y < rectCell.bottom )
  172. return CFormView::PreTranslateMessage(pMsg);
  173. int nSelRow = m_Grid.GetFocusCell().row;
  174. if( nSelRow >= 1 && nSelRow < m_Grid.GetRowCount() )
  175. {
  176. int id = m_Grid.GetItemData(nSelRow,0);
  177. OnDblclkItem( id );
  178. }
  179. }
  180. }
  181. return CFormView::PreTranslateMessage(pMsg);
  182. }
  183. void CSelectorView::DoDataExchange(CDataExchange* pDX)
  184. {
  185. CFormView::DoDataExchange(pDX);
  186. //{{AFX_DATA_MAP(CSelectorView)
  187. DDX_Control(pDX, IDC_STATIC_INFO, m_staticInfo);
  188. DDX_Control(pDX, IDC_PROGRESS, m_progress);
  189. DDX_Control(pDX, IDC_RUNSELECTOR, m_btnRunSelector);
  190. DDX_Control(pDX, IDC_TECH, m_cmbTech);
  191. DDX_Control(pDX, IDC_KTYPE, m_cmbKType);
  192. DDX_Control(pDX, IDC_STOCKGROUP, m_cmbStockGroup);
  193. //}}AFX_DATA_MAP
  194. DDX_GridControl(pDX, IDC_GRID, m_Grid);
  195. }
  196. void CSelectorView::OnInitialUpdate()
  197. {
  198. CFormView::OnInitialUpdate();
  199. InitializeGrid( );
  200. m_staticInfo.SetWindowPos( NULL, 0, 0, 0, 0, SWP_HIDEWINDOW | SWP_NOMOVE | SWP_NOSIZE );
  201. m_progress.SetWindowPos( NULL, 0, 0, 0, 0, SWP_HIDEWINDOW | SWP_NOMOVE | SWP_NOSIZE );
  202. LOGFONT lf;
  203. memset( &lf, 0, sizeof(lf) );
  204. AfxGetProfile().GetFontSListView( &lf );
  205. SetFont( &lf );
  206. m_cmbStockGroup.InitStrings( TRUE, TRUE, AfxGetGroupContainer( ) );
  207. m_cmbStockGroup.SetCurSel( 0 );
  208. m_cmbStockGroup.SelectGroupAll( );
  209. m_cmbKType.InitializeDay( );
  210. m_cmbTech.Initialize();
  211. }
  212. void CSelectorView::OnUpdate(CView* pSender, LPARAM lHint, CObject* pHint) 
  213. {
  214. // TODO: Add your specialized code here and/or call the base class
  215. if( UPDATE_HINT_SELECTORVIEW != lHint )
  216. return;
  217. if( IsWindowVisible() )
  218. SetFocus( );
  219. int nColumnCount = m_Grid.GetColumnCount();
  220. if( nColumnCount <= 0 )
  221. return;
  222. if( GetParentFrame()->GetSafeHwnd() != AfxGetMainFrame()->GetActiveFrame()->GetSafeHwnd() )
  223. {
  224. m_bShouldUpdate = TRUE;
  225. return;
  226. }
  227. m_bShouldUpdate = FALSE;
  228. m_Grid.DeleteNonFixedRows();
  229. // Progress
  230. CMainFrame * pMainFrame = AfxGetMainFrame();
  231. if( pMainFrame )
  232. {
  233. pMainFrame->ShowProgressBar( );
  234. pMainFrame->SetProgress( 0 );
  235. pMainFrame->SetMessageText( IDS_MAINFRAME_WAITING );
  236. }
  237. CRect rectClient;
  238. GetClientRect( &rectClient );
  239. int nPageCount = 1 + rectClient.Height() / abs(m_Grid.GetFixedRowHeight()) + 1;
  240. for( int i=0; i<m_container.GetSize() && i<m_signals.GetSize(); i++ )
  241. {
  242. CStockInfo & info = m_container.GetStockInfoByID(i);
  243. int nRow = m_Grid.InsertRow( info.GetStockName() );
  244. m_Grid.SetItemData( nRow, 0, i );
  245. for( int nCol=0; nCol<SELECTORVIEW_COLUMN_COUNT; nCol++ )
  246. {
  247. m_Grid.SetItemFormat( nRow, nCol, DT_CENTER|DT_VCENTER|DT_SINGLELINE );
  248. if( 0 == nCol )
  249. m_Grid.SetItemText( nRow, nCol, AfxGetVariantDispString( SLH_CODE, info, &m_container ) );
  250. else if( 1 == nCol )
  251. m_Grid.SetItemText( nRow, nCol, AfxGetVariantDispString( SLH_NAME, info, &m_container ) );
  252. else if( 2 == nCol )
  253. m_Grid.SetItemText( nRow, nCol, AfxGetVariantDispString( SLH_DATE, info, &m_container ) );
  254. else if( 3 == nCol )
  255. m_Grid.SetItemText( nRow, nCol, AfxGetVariantDispString( SLH_CLOSE, info, &m_container ) );
  256. else if( 4 == nCol )
  257. m_Grid.SetItemText( nRow, nCol, AfxGetIntensityString( m_signals.GetAt(i) ) );
  258. else if( 5 == nCol && i<m_reasons.GetSize() )
  259. m_Grid.SetItemText( nRow, nCol, AfxGetIntensityCodeString( m_reasons.GetAt(i) ) );
  260. m_Grid.SetItemBkColour( nRow, nCol, AfxGetProfile().GetColor(CColorClass::clrSListBK) );
  261. if( 4 == nCol )
  262. m_Grid.SetItemFgColour( nRow, nCol, ((int)m_signals[i]) > 0 ? AfxGetProfile().GetColor(CColorClass::clrRise) : AfxGetProfile().GetColor(CColorClass::clrFall) );
  263. else
  264. m_Grid.SetItemFgColour( nRow, nCol, AfxGetProfile().GetColor(CColorClass::clrText) );
  265. }
  266. if( i == nPageCount+5 )
  267. {
  268. m_Grid.Invalidate( );
  269. MSG msg;
  270. while (::PeekMessage(&msg, NULL, NULL, NULL, PM_NOREMOVE) )
  271. AfxGetApp()->PumpMessage();
  272. }
  273. if( pMainFrame )
  274. pMainFrame->SetProgress( 100*i/m_container.GetSize() );
  275. }
  276. if( pMainFrame )
  277. {
  278. pMainFrame->SetProgress( 100 );
  279. pMainFrame->HideProgressBar( );
  280. pMainFrame->SetMessageText( IDS_MAINFRAME_FINISHED );
  281. }
  282. m_Grid.Invalidate( );
  283. }
  284. /////////////////////////////////////////////////////////////////////////////
  285. // CSelectorView printing
  286. BOOL CSelectorView::OnPreparePrinting(CPrintInfo* pInfo)
  287. {
  288. // default preparation
  289. return DoPreparePrinting(pInfo);
  290. }
  291. void CSelectorView::OnBeginPrinting(CDC* pDC, CPrintInfo* pInfo)
  292. {
  293. if( ::IsWindow( m_Grid.GetSafeHwnd() ) )
  294. m_Grid.OnBeginPrinting(pDC, pInfo);
  295. }
  296. void CSelectorView::OnPrint(CDC* pDC, CPrintInfo* pInfo) 
  297. {
  298. if( ::IsWindow( m_Grid.GetSafeHwnd() ) )
  299. m_Grid.OnPrint(pDC, pInfo);
  300. }
  301. void CSelectorView::OnEndPrinting(CDC* pDC, CPrintInfo* pInfo)
  302. {
  303. if( ::IsWindow( m_Grid.GetSafeHwnd() ) )
  304. m_Grid.OnEndPrinting(pDC, pInfo);
  305. }
  306. void CSelectorView::OnFilePrint() 
  307. {
  308. if( ::IsWindow( m_Grid.GetSafeHwnd() ) )
  309. m_Grid.Print( );
  310. }
  311. void CSelectorView::OnUpdateFilePrint(CCmdUI* pCmdUI) 
  312. {
  313. pCmdUI->Enable( ::IsWindow( m_Grid.GetSafeHwnd() ) );
  314. }
  315. /////////////////////////////////////////////////////////////////////////////
  316. // CSelectorView diagnostics
  317. #ifdef _DEBUG
  318. void CSelectorView::AssertValid() const
  319. {
  320. CFormView::AssertValid();
  321. }
  322. void CSelectorView::Dump(CDumpContext& dc) const
  323. {
  324. CFormView::Dump(dc);
  325. }
  326. #endif //_DEBUG
  327. /////////////////////////////////////////////////////////////////////////////
  328. // CSelectorView message handlers
  329. int CSelectorView::OnCreate(LPCREATESTRUCT lpCreateStruct) 
  330. {
  331. if (CFormView::OnCreate(lpCreateStruct) == -1)
  332. return -1;
  333. return 0;
  334. }
  335. void CSelectorView::OnDestroy() 
  336. {
  337. CFormView::OnDestroy();
  338. }
  339. void CSelectorView::OnTimer(UINT nIDEvent) 
  340. {
  341. CFormView::OnTimer(nIDEvent);
  342. }
  343. void CSelectorView::OnActivateView(BOOL bActivate, CView* pActivateView, CView* pDeactiveView) 
  344. {
  345. // TODO: Add your specialized code here and/or call the base class
  346. if( bActivate && m_bShouldUpdate )
  347. {
  348. OnUpdate( NULL, UPDATE_HINT_SELECTORVIEW, NULL );
  349. m_bShouldUpdate = FALSE;
  350. }
  351. CFormView::OnActivateView(bActivate, pActivateView, pDeactiveView);
  352. }
  353. LRESULT CSelectorView::OnGetViewTitle(WPARAM wParam, LPARAM lParam)
  354. {
  355. CString strTitle;
  356. strTitle.LoadString( IDS_TITLE_SELECTORVIEW );
  357. lstrcpyn((LPTSTR)lParam, (LPCTSTR)strTitle, wParam);
  358. if ((int)wParam > strTitle.GetLength())
  359. wParam = strTitle.GetLength();
  360. return wParam;
  361. }
  362. LRESULT CSelectorView::OnGetViewCmdid(WPARAM wParam, LPARAM lParam)
  363. {
  364. if( lParam )
  365. *((LPARAM *)lParam) = ID_VIEW_SELECTOR;
  366. return 0L;
  367. }
  368. LRESULT CSelectorView::OnCanCloseView(WPARAM wParam, LPARAM lParam)
  369. {
  370. if( lParam )
  371. *((BOOL *)lParam) = !m_bRunning;
  372. return 0L;
  373. }
  374. LRESULT CSelectorView::OnColorChange(WPARAM wParam, LPARAM lParam)
  375. {
  376. m_Grid.SetBkColor( AfxGetProfile().GetColor(CColorClass::clrSListBK) );
  377. m_Grid.SetTextBkColor( AfxGetProfile().GetColor(CColorClass::clrSListBK) );
  378. m_Grid.SetSelectedBkColor(AfxGetProfile().GetColor(CColorClass::clrSListSelected));
  379. OnUpdate( NULL, UPDATE_HINT_SELECTORVIEW, NULL );
  380. Invalidate();
  381. return 0L;
  382. }
  383. BOOL CSelectorView::OnEraseBkgnd(CDC* pDC) 
  384. {
  385. // TODO: Add your message handler code here and/or call default
  386. if( pDC && pDC->IsKindOf(RUNTIME_CLASS(CDC)) )
  387. {
  388. CRect rect;
  389. GetClientRect( &rect );
  390. CBrush brush;
  391. brush.CreateSolidBrush( AfxGetProfile().GetColor(CColorClass::clrSimuBK) );
  392. pDC->FillRect( &rect, &brush );
  393. return TRUE;
  394. }
  395. return CFormView::OnEraseBkgnd(pDC);
  396. }
  397. void CSelectorView::OnSize(UINT nType, int cx, int cy) 
  398. {
  399. CSize sizeTotal( cx, cy );
  400. SetScaleToFitSize( sizeTotal );
  401. CFormView::OnSize(nType, cx, cy);
  402. }
  403. void CSelectorView::OnSetFocus(CWnd* pOldWnd) 
  404. {
  405. CFormView::OnSetFocus(pOldWnd);
  406. // TODO: Add your message handler code here
  407. m_Grid.SetFocus();
  408. if( !m_Grid.GetFocusCell().IsValid()
  409. && m_Grid.GetRowCount() > 1 && m_Grid.GetColumnCount() > 1 )
  410. {
  411. m_Grid.SetFocusCell( 1, 1 );
  412. for( int nCol=0; nCol<m_Grid.GetColumnCount(); nCol ++ )
  413. m_Grid.SetItemState(1,nCol,m_Grid.GetItemState(1,nCol) | GVIS_SELECTED);
  414. }
  415. }
  416. HBRUSH CSelectorView::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor) 
  417. {
  418. if( pDC )
  419. pDC->SetTextColor( AfxGetProfile().GetColor( CColorClass::clrSimuText ) );
  420. if( nCtlColor == CTLCOLOR_DLG
  421. || nCtlColor == CTLCOLOR_STATIC
  422. || nCtlColor == CTLCOLOR_MSGBOX )
  423. {
  424. if( nCtlColor == CTLCOLOR_STATIC )
  425. pDC->SetBkMode( TRANSPARENT );
  426. static CBrush brushBK;
  427. static COLORREF clrBKLast = RGB(255,255,255);
  428. COLORREF clrBKNow = AfxGetProfile().GetColor( CColorClass::clrSimuBK );
  429. if( NULL == brushBK.GetSafeHandle() || clrBKLast != clrBKNow )
  430. {
  431. brushBK.DeleteObject( );
  432. VERIFY( brushBK.CreateSolidBrush( clrBKNow ) );
  433. }
  434. clrBKLast = clrBKNow;
  435. return (HBRUSH)brushBK.GetSafeHandle();
  436. }
  437. return CFormView::OnCtlColor(pDC, pWnd, nCtlColor);
  438. }
  439. void CSelectorView::OnRunselector() 
  440. {
  441. m_bRunning = TRUE;
  442. // clear
  443. m_btnRunSelector.EnableWindow( FALSE );
  444. m_staticInfo.SetWindowPos( NULL, 0, 0, 0, 0, SWP_HIDEWINDOW | SWP_NOMOVE | SWP_NOSIZE );
  445. m_container.Clear();
  446. m_signals.RemoveAll();
  447. m_reasons.RemoveAll();
  448. OnUpdate( NULL, UPDATE_HINT_SELECTORVIEW, NULL );
  449. // get parameters
  450. CStockContainer cntn;
  451. cntn.RetrieveFromStatic( m_cmbStockGroup.GetCurSelType(), m_cmbStockGroup.GetCurSelName(), NULL, -1 );
  452. int nKType = m_cmbKType.GetSelect();
  453. int nTech = m_cmbTech.GetSelect();
  454. // progress
  455. m_progress.SetWindowPos( NULL, 0, 0, 0, 0, SWP_SHOWWINDOW | SWP_NOMOVE | SWP_NOSIZE );
  456. m_progress.SetRange( 0, cntn.GetSize() );
  457. m_progress.SetPos( 0 );
  458. // run selector
  459. for( int i=0; i<cntn.GetSize(); i++ )
  460. {
  461. m_progress.SetPos( i+1 );
  462. MSG msg;
  463. while (::PeekMessage(&msg, NULL, NULL, NULL, PM_NOREMOVE) )
  464. AfxGetApp()->PumpMessage();
  465. CStockInfo & info = cntn.ElementAt(i);
  466. int its = ITS_NOTHING;
  467. UINT itsc = ITSC_NOTHING;
  468. CStock stock;
  469. if( !stock.SetStockInfo( &info ) )
  470. continue;
  471. if( !AfxPrepareStockData( &AfxGetDB(), stock, nKType, CKData::formatXDRdown, AfxGetProfile().GetGraphMaindataType(), FALSE, FALSE ) )
  472. continue;
  473. CKData & kdata = stock.GetKData( nKType );
  474. if( kdata.GetSize() < 1 )
  475. continue;
  476. CTechnique * pTech = CTechnique::CreateTechnique( nTech, &kdata );
  477. if( NULL == pTech )
  478. continue;
  479. AfxGetProfile().GetTechParameters().FindParameters( nTech, pTech );
  480. its = pTech->GetSignal( kdata.GetSize()-1, &itsc );
  481. if( ITS_NOTHING != its )
  482. {
  483. m_container.Add( info );
  484. m_signals.Add( its );
  485. m_reasons.Add( itsc );
  486. }
  487. delete pTech;
  488. }
  489. // display result
  490. OnUpdate( NULL, UPDATE_HINT_SELECTORVIEW, NULL );
  491. if( 0 == m_container.GetSize() )
  492. m_staticInfo.SetWindowPos( NULL, 0, 0, 0, 0, SWP_SHOWWINDOW | SWP_NOMOVE | SWP_NOSIZE );
  493. m_btnRunSelector.EnableWindow( TRUE );
  494. m_bRunning = FALSE;
  495. }