BOOL CSelectStk::OnInitDialog() { CPropertyPageEx::OnInitDialog(); CWaitCursor waitcursor; // TODO: Add extra initialization here CDomainContainer & groups = AfxGetGroupContainer( ); CDomainContainer & domains = AfxGetDomainContainer( ); CStockContainer & container = AfxGetStockContainer(); // Src m_comboGroupSrc.InitStrings( TRUE, TRUE, groups ); m_comboGroupSrc.SetCurSel( 0 ); OnSelchangeComboGroupsrc(); // Dest m_listStockDest.InitStorage( m_listStockSrc.GetCount(), 32 ); CStockContainer cntn; if( cntn.RetrieveSpecify( m_domainTemp ) ) { for( int i=0; i<cntn.GetSize(); i++ ) { CStockInfo & info = cntn.ElementAt(i); CString strItem = CString(info.GetStockCode()) + "(" + info.GetStockShortName() + ") "; while( strItem.GetLength() < 16 ) strItem += " "; strItem += info.GetStockName() ; int nItem = m_listStockDest.AddString( strItem ); } } return TRUE; // return TRUE unless you set the focus to a control // EXCEPTION: OCX Property Pages should return FALSE }
BOOL CSetGroupDlg::OnInitDialog() { CXFDialog::OnInitDialog(); CWaitCursor waitcursor; // TODO: Add extra initialization here CDomainContainer & groups = AfxGetGroupContainer( ); CDomainContainer & domains = AfxGetDomainContainer( ); CStockContainer & container = AfxGetStockContainer(); m_grpTemp = groups; // Src m_comboGroupSrc.InitStrings( TRUE, TRUE, groups ); m_comboGroupSrc.SetCurSel( 0 ); OnSelchangeComboGroupsrc(); // Dest m_comboGroupDest.InitStrings( FALSE, FALSE, m_grpTemp ); m_comboGroupDest.SetCurSel( 0 ); if( m_strInitialGroupName.GetLength() > 0 && CB_ERR != m_comboGroupDest.SelectString( 0, m_strInitialGroupName ) ) { for( int k=0; k<m_astrInitialGroupStocks.GetSize(); k++ ) m_grpTemp.AddDomainStock( m_strInitialGroupName, m_astrInitialGroupStocks.ElementAt(k) ); } OnSelchangeComboGroupdest(); return TRUE; // return TRUE unless you set the focus to a control // EXCEPTION: OCX Property Pages should return FALSE }
BOOL CSetKDataDlg::OnInitDialog() { CPropertyPageEx::OnInitDialog(); EnableEdit( FALSE ); CWaitCursor waitcursor; // TODO: Add extra initialization here CDomainContainer & groups = AfxGetGroupContainer( ); CDomainContainer & domains = AfxGetDomainContainer( ); CStockContainer & container = AfxGetStockContainer(); // Src m_comboGroupSrc.InitStrings( TRUE, TRUE, groups ); m_comboGroupSrc.SetCurSel( 0 ); OnSelchangeComboGroupsrc(); OnSelchangeListStocksrc(); m_comboKType.InitializeDayMin5(); return TRUE; // return TRUE unless you set the focus to a control // EXCEPTION: OCX Property Pages should return FALSE }
BOOL CStkUIApp::OnDBChanged( BOOL bRecalculate ) { CWaitCursor waitcursor; // Reload DB AfxGetStockContainer().Load( &AfxGetDB(), NULL, NULL ); AfxGetDomainContainer().Load( AfxGetProfile().GetDomainFile() ); AfxGetGroupContainer().Load( AfxGetProfile().GetGroupFile() ); AfxGetDB().LoadKDataCache( AfxGetStockContainer(), NULL, NULL, 0, STKLIB_MAX_PROGRESS ); AfxGetStockContainer().OnDataChanged( ); AfxGetStkReceiver().RefreshStockContainer( AfxGetStockContainer(), TRUE ); // Reload AfxGetStockMain() AfxReloadStockMain( ); // Recalcuate Yield if( bRecalculate && IDYES == AfxMessageBox( IDS_INSTALLPAC_IFRECALCULATE, MB_YESNO|MB_ICONINFORMATION ) ) { AfxRecalculateYield( AfxGetProfile().GetYieldAverageDays(), TRUE ); AfxGetStockContainer().ReloadBase( &AfxGetDB() ); } // Update SListBar CMainFrame * pMainFrame = AfxGetMainFrame(); if( pMainFrame ) { pMainFrame->m_SearchBox.InitStocks( TRUE, TRUE, TRUE ); pMainFrame->m_SearchBox.SetCurrentWindowText( ); //pMainFrame->m_DateBox.InitDates( ); //pMainFrame->m_DateBox.SetCurrentWindowText( ); } // Update Views AfxGetSListStockContainer().ReRetrieveFromStatic( AfxGetActiveStrategy(), TRUE ); AfxGetStaticDoc()->UpdateAllViews( NULL, UPDATE_HINT_SLISTVIEW, NULL ); AfxGetStaticDoc()->UpdateAllViews( NULL, UPDATE_HINT_GRAPHVIEW, NULL ); AfxGetStaticDoc()->UpdateAllViews( NULL, UPDATE_HINT_BASEVIEW, NULL ); AfxGetStaticDoc()->UpdateAllViews( NULL, UPDATE_HINT_SIMUVIEW_REREALRUN, NULL ); AfxGetStaticDoc()->UpdateAllViews( NULL, UPDATE_HINT_SELECTORVIEW, NULL ); ::PostMessage( AfxGetGroupView()->GetSafeHwnd(), WM_USER_UPDATEGROUPS, 0, 0 ); return TRUE; }
void CGroupView::OnUpdate(CView* pSender, LPARAM lHint, CObject* pHint) { CTreeCtrl &treectrl = GetTreeCtrl(); treectrl.DeleteAllItems( ); CString strGroups, strDomains; VERIFY( strGroups.LoadString( IDS_GROUPVIEW_GROUP ) ); VERIFY( strDomains.LoadString( IDS_GROUPVIEW_DOMAIN ) ); HTREEITEM hGroups = NULL, hDomains = NULL; VERIFY( hGroups = treectrl.InsertItem(strGroups,IMG_GROUPS,IMG_GROUPS_SEL) ); VERIFY( hDomains = treectrl.InsertItem(strDomains,IMG_DOMAINS,IMG_DOMAINS_SEL) ); if( NULL == hGroups || NULL == hDomains ) return; HTREEITEM hItem = NULL; CDomainContainer & groups = AfxGetGroupContainer(); for( int k=0; k<groups.GetSize(); k ++ ) { CDomain & domain = groups.ElementAt(k); VERIFY( hItem = treectrl.InsertItem(domain.m_strName, IMG_GROUP, IMG_GROUP_SEL,hGroups) ); treectrl.SetItemData( hItem, GV_ITEM_GROUP ); } CDomainContainer & domains = AfxGetDomainContainer(); for( k=0; k<domains.GetSize(); k ++ ) { CDomain & domain = domains.ElementAt(k); VERIFY( hItem = treectrl.InsertItem(domain.m_strName, IMG_DOMAIN, IMG_DOMAIN_SEL,hDomains) ); treectrl.SetItemData( hItem, GV_ITEM_DOMAIN ); } treectrl.Expand( hGroups, TVE_EXPAND ); treectrl.Expand( hDomains, TVE_EXPAND ); treectrl.Select( hGroups, TVGN_CARET ); CWnd * pParent = GetParent(); if( pParent && ::IsWindow(pParent->GetSafeHwnd()) ) pParent->Invalidate(); }
void CSetBaseDlg::OnStart() { UpdateData( ); CNetDatabase netdb; if( !netdb.SetRootPath( AfxGetProfile().GetSelfDBPath(), IStStore::dbtypeSelfDB ) ) { AfxMessageBox( IDS_ROOTPATH_ERROR, MB_OK | MB_ICONINFORMATION ); return; } if( ( m_strFileF10.IsEmpty() && m_strFileTdx.IsEmpty() && m_strFileFxj.IsEmpty() && m_strPathFxjBlock.IsEmpty() ) || ( 0 != access(m_strFileF10,0) && 0 != access(m_strFileTdx,0) && 0 != access(m_strFileFxj,0) && 0 != access(m_strPathFxjBlock,0) ) ) { AfxMessageBox( IDS_SETBASE_FILENOTEXISTS, MB_OK|MB_ICONINFORMATION ); return; } m_btnStart.EnableWindow( FALSE ); AfxGetApp()->WriteProfileString( "setbasedlg", "filef10", m_strFileF10 ); AfxGetApp()->WriteProfileString( "setbasedlg", "filetdx", m_strFileTdx ); AfxGetApp()->WriteProfileString( "setbasedlg", "filefxj", m_strFileFxj ); AfxGetApp()->WriteProfileString( "setbasedlg", "pathfxjblock", m_strPathFxjBlock ); m_ctrlProgress.SetWindowPos( NULL, 0, 0, 0, 0, SWP_SHOWWINDOW | SWP_NOSIZE | SWP_NOMOVE ); m_ctrlProgress.SetRange( 0, STKLIB_MAX_PROGRESS ); m_ctrlProgress.SetPos( 0 ); if( m_strFileF10.GetLength() > 0 ) { CPackage pac; pac.m_nType = CPackage::packageBasetext; pac.m_bIsZipped = ( m_strFileF10.GetLength() > 4 && 0 == m_strFileF10.Right(4).CompareNoCase(".zip") ); pac.m_strDescript = m_strFileF10; if( netdb.InstallPackageEx( pac, m_strFileF10, InstallBaseCallback, GetSafeHwnd() ) ) AfxMessageBox( IDS_SETBASE_INSTALLF10OK, MB_OK|MB_ICONINFORMATION ); else AfxMessageBox( IDS_SETBASE_INSTALLF10FAIL, MB_OK|MB_ICONINFORMATION ); } if( m_strFileTdx.GetLength() > 0 ) { CPackage pac; pac.m_nType = CPackage::packageBasetable; pac.m_bIsZipped = ( m_strFileTdx.GetLength() > 4 && 0 == m_strFileTdx.Right(4).CompareNoCase(".zip") ); pac.m_strDescript = m_strFileTdx; if( netdb.InstallPackageEx( pac, m_strFileTdx, NULL, NULL ) ) AfxMessageBox( IDS_SETBASE_INSTALLTDXOK, MB_OK|MB_ICONINFORMATION ); else AfxMessageBox( IDS_SETBASE_INSTALLTDXFAIL, MB_OK|MB_ICONINFORMATION ); } if( m_strFileFxj.GetLength() > 0 ) { CPackage pac; pac.m_nType = CPackage::packageBasetable; pac.m_bIsZipped = ( m_strFileFxj.GetLength() > 4 && 0 == m_strFileFxj.Right(4).CompareNoCase(".zip") ); pac.m_strDescript = m_strFileFxj; if( netdb.InstallPackageEx( pac, m_strFileFxj, NULL, NULL ) ) AfxMessageBox( IDS_SETBASE_INSTALLFXJOK, MB_OK|MB_ICONINFORMATION ); else AfxMessageBox( IDS_SETBASE_INSTALLFXJFAIL, MB_OK|MB_ICONINFORMATION ); } if( m_strPathFxjBlock.GetLength() > 0 ) { CPackage pac; pac.m_nType = CPackage::packageCode; pac.m_bIsZipped = ( m_strPathFxjBlock.GetLength() > 4 && 0 == m_strPathFxjBlock.Right(4).CompareNoCase(".zip") ); pac.m_strDescript = m_strPathFxjBlock; BOOL bOK = FALSE; int nFileCountTotal = CNetDatabase::GetFileCount( m_strPathFxjBlock, FALSE ); DWORD attr = GetFileAttributes( m_strPathFxjBlock ); if( 0xFFFFFFFF != attr && (attr & FILE_ATTRIBUTE_DIRECTORY) ) bOK = netdb.InstallPackagePath( pac, m_strPathFxjBlock, InstallBaseCallback, GetSafeHwnd(), nFileCountTotal, 0, FALSE ); else bOK = netdb.InstallPackage( pac, m_strPathFxjBlock, InstallBaseCallback, GetSafeHwnd() ); if( bOK ) { AfxGetDomainContainer().Store( AfxGetProfile().GetDomainFile() ); AfxMessageBox( IDS_SETBASE_INSTALLFXJBLOCKOK, MB_OK|MB_ICONINFORMATION ); } else AfxMessageBox( IDS_SETBASE_INSTALLFXJBLOCKFAIL, MB_OK|MB_ICONINFORMATION ); } m_ctrlProgress.SetPos( STKLIB_MAX_PROGRESS ); m_btnStart.EnableWindow( TRUE ); AfxGetStockContainer().ReloadBase( &AfxGetDB() ); AfxGetSListStockContainer().ReRetrieveFromStatic( AfxGetActiveStrategy() ); AfxGetStaticDoc()->UpdateAllViews( NULL, UPDATE_HINT_GRAPHVIEW, NULL ); AfxGetStaticDoc()->UpdateAllViews( NULL, UPDATE_HINT_BASEVIEW, NULL ); AfxGetStaticDoc()->UpdateAllViews( NULL, UPDATE_HINT_SLISTVIEW, NULL ); AfxGetStaticDoc()->UpdateAllViews( NULL, UPDATE_HINT_SELECTORVIEW, NULL ); }
BOOL CStockContainer::RetrieveFromStatic( int nType, LPCTSTR lpszDomain, CStrategy * pStrategy, DWORD dwDate ) { CSPMutex::Scoped l(m_mutex); Clear( ); if( nType == typeNone ) { m_nType = typeNone; return TRUE; } if( nType < typeMin || nType > typeMax ) return FALSE; m_nType = nType; m_dwDate = dwDate; CSPStringArray astrSpecify; switch( nType ) { case typeAll: CopyData( AfxGetStockContainer() ); break; case typeIndex: case typeA: case typeBond: case typeFund: case typeClassShaa: case typeClassShab: case typeClassSzna: case typeClassSznb: case typeClassShabond: case typeClassSznbond: { int nCount = 0; SetSize( 0, AfxGetStockContainer().GetSize() ); for( int i=0; i<AfxGetStockContainer().GetSize(); i++ ) { CStockInfo & info = AfxGetStockContainer().ElementAt(i); LONG stocktype = info.GetType(); if( ( typeIndex == nType && CStock::typeshIndex == stocktype ) || ( typeIndex == nType && CStock::typeszIndex == stocktype ) || ( typeA == nType && (CStock::typeshA == stocktype || CStock::typeszA == stocktype) && !info.IsFund() ) || ( typeBond == nType && (CStock::typeshBond == stocktype || CStock::typeszBond == stocktype) ) || ( typeFund == nType && info.IsFund() ) || ( typeClassShaa == nType && CStock::typeshA == stocktype ) || ( typeClassShab == nType && CStock::typeshB == stocktype ) || ( typeClassSzna == nType && CStock::typeszA == stocktype ) || ( typeClassSznb == nType && CStock::typeszB == stocktype ) || ( typeClassShabond == nType && CStock::typeshBond == stocktype ) || ( typeClassSznbond == nType && CStock::typeszBond == stocktype ) ) { Add( info ); nCount ++; } } SetSize( nCount ); } break; case typeStrategy: { if( pStrategy ) RetrieveSpecify( pStrategy->GetStocks() ); } break; case typeGroup: { if( lpszDomain && strlen(lpszDomain) > 0 ) { AfxGetGroupContainer().GetDomainStocks( lpszDomain, astrSpecify ); RetrieveSpecify( astrSpecify ); m_strDomain = lpszDomain; } else return AfxGetGroupContainer().GetAllDomainInfo( this, m_dwDate ); } break; case typeDomain: { if( lpszDomain && strlen(lpszDomain) > 0 ) { AfxGetDomainContainer().GetDomainStocks( lpszDomain, astrSpecify ); RetrieveSpecify( astrSpecify ); m_strDomain = lpszDomain; } else return AfxGetDomainContainer().GetAllDomainInfo( this, m_dwDate ); } break; default: SP_ASSERT( FALSE ); SetMap( ); SetAverage( ); return FALSE; } SetMap( ); DWORD dwMainDate = -1; AfxGetStockContainer().GetCurrentType( NULL, NULL, &dwMainDate ); if( m_dwDate != dwMainDate ) OnDataChanged(); else SetAverage( ); return TRUE; }
int CDomainComboBox::InitStrings( BOOL bHasClass, BOOL bHasDomain, CDomainContainer & groups ) { ResetContent( ); CDomainContainer & domains = AfxGetDomainContainer( ); CStockContainer & container = AfxGetStockContainer(); int nItemCount = groups.GetSize(); if( bHasClass ) nItemCount += 8; if( bHasDomain ) nItemCount += domains.GetSize(); // Init Storage InitStorage( nItemCount, 32 ); CString strGroup; if( bHasClass ) { strGroup.LoadString( IDS_DOMAIN_ALL ); int nItem = AddString( strGroup ); SetItemData( nItem, CStockContainer::typeAll ); strGroup.LoadString( IDS_DOMAIN_INDEX ); nItem = AddString( strGroup ); SetItemData( nItem, CStockContainer::typeIndex ); strGroup.LoadString( IDS_DOMAIN_CLASSSHAA ); nItem = AddString( strGroup ); SetItemData( nItem, CStockContainer::typeClassShaa ); strGroup.LoadString( IDS_DOMAIN_CLASSSHAB ); nItem = AddString( strGroup ); SetItemData( nItem, CStockContainer::typeClassShab ); strGroup.LoadString( IDS_DOMAIN_CLASSSZNA ); nItem = AddString( strGroup ); SetItemData( nItem, CStockContainer::typeClassSzna ); strGroup.LoadString( IDS_DOMAIN_CLASSSZNB ); nItem = AddString( strGroup ); SetItemData( nItem, CStockContainer::typeClassSznb ); strGroup.LoadString( IDS_DOMAIN_CLASSSHABOND ); nItem = AddString( strGroup ); SetItemData( nItem, CStockContainer::typeClassShabond ); strGroup.LoadString( IDS_DOMAIN_CLASSSZNBOND ); nItem = AddString( strGroup ); SetItemData( nItem, CStockContainer::typeClassSznbond ); } // Domains if( bHasDomain ) { for( int i=0; i<domains.GetSize(); i++ ) { CDomain & domain = domains.ElementAt(i); int nItem = AddString( domain.m_strName ); SetItemData( nItem, CStockContainer::typeDomain ); } } // Groups for( int i=0; i<groups.GetSize(); i++ ) { CDomain & domain = groups.ElementAt(i); int nItem = AddString( domain.m_strName ); SetItemData( nItem, CStockContainer::typeGroup ); } return nItemCount; }
BOOL CStkUIApp::InitInstance() { // Standard initialization // If you are not using these features and wish to reduce the size // of your final executable, you should remove from the following // the specific initialization routines you do not need. AfxSocketInit( ); AfxOleInit(); // 程序只能启动一个实例 m_pMutex = CreateMutex(NULL, FALSE, _T("TsKing")); if (m_pMutex != NULL) { if (GetLastError() == ERROR_ALREADY_EXISTS) { CloseHandle(m_pMutex); m_pMutex = NULL; return FALSE; } } GetVersionNumber(); AfxGetProfile().LoadProfile( ); ::SetCurrentDirectory( AfxGetProfile().GetWorkDirectory() ); AfxGetSView().Load( AfxGetProfile().GetSViewFile() ); // Change the registry key under which our settings are stored. // TODO: You should modify this string to be something appropriate // such as the name of your company or organization. // SetRegistryKey( szRegKeyCompany ); AfxRegSetValue( szRegKeyCompany, szRegKeyApp, "Install", "Path", AfxGetProfile().GetWorkDirectory() ); AfxRegSetValue( szRegKeyCompany, szRegKeyApp, "Install", "Version", AfxGetProfile().GetVersion() ); // change profile ( INI file ) BOOL bEnable = AfxEnableMemoryTracking(FALSE); if( m_pszProfileName ) free((void*)m_pszProfileName); m_pszProfileName = _tcsdup(AfxGetProfile().GetWorkDirectory()+m_pszExeName+".ini"); AfxEnableMemoryTracking(bEnable); LoadStdProfileSettings(64); // Load standard INI file options (including MRU) // Register the application's document templates. Document templates // serve as the connection between documents, frame windows and views. // Enable DDE Execute open EnableShellOpen(); AfxUnregisterShellFileTypes(); // AfxRegisterShellFileTypes(FALSE); // Empty Temp Directory { CNetDatabase netdb; if (netdb.SetRootPath(AfxGetProfile().GetSelfDBPath(), IStStore::dbtypeSelfDB)) netdb.EmptyTempDirectory(); } AfxSetDB(&AfxGetNetDB()); //*/ // Load Data char szErr[1024]; if (!AfxInitializeDB(szErr, sizeof(szErr))) { AfxMessageBox(szErr, MB_OK | MB_ICONINFORMATION); return FALSE; } // 初始化 AfxGetStockContainer().Load(&AfxGetDB(), NULL, NULL); // 读取证券信息,代码表、财务、除权等 AfxGetDomainContainer().Load(AfxGetProfile().GetDomainFile()); // 读取板块 AfxGetGroupContainer().Load(AfxGetProfile().GetGroupFile()); // 读取自选板块 // 分析标准外壳命令、DDE、打开文件操作的命令行 CCommandLineInfo cmdInfo; ParseCommandLine(cmdInfo); #ifdef _TSK_MAINFRAME // 注册应用程序的文档模板。文档模板 // 将用作文档、框架窗口和视图之间的连接 CSingleDocTemplate* pDocTemplate; pDocTemplate = new CSingleDocTemplate( IDR_MAINFRAME, RUNTIME_CLASS(CStaticDoc), RUNTIME_CLASS(CMainFrame), // 主 SDI 框架窗口 RUNTIME_CLASS(CSListView)); if (!pDocTemplate) return FALSE; AddDocTemplate(pDocTemplate); // 调度在命令行中指定的命令。如果 // 用 /RegServer、/Register、/Unregserver 或 /Unregister 启动应用程序,则返回 FALSE。 if (!ProcessShellCommand(cmdInfo)) return FALSE; #else // Create MainFrame and Static Doc and child frames and static views CStaticDoc* pStaticDoc = CStaticDoc::OpenDocumentFile(NULL); if (pStaticDoc == NULL) { AfxMessageBox(IDS_STATICDOC_FAILED, MB_OK | MB_ICONINFORMATION); return FALSE; } pStaticDoc->m_bAutoDelete = FALSE; CString strAppTitle; strAppTitle.LoadString(AFX_IDS_APP_TITLE); pStaticDoc->SetTitle(strAppTitle); SetStaticDoc(pStaticDoc); // Create MainFrame CMainFrame* pMainFrame = CMainFrame::CreateNewFrame(); if (pMainFrame == NULL) { AfxMessageBox(IDS_STATICDOC_FAILED, MB_OK | MB_ICONINFORMATION); delete pStaticDoc; SetStaticDoc(NULL); return FALSE; } SetMainWnd(pMainFrame); #endif // 股票行情接收 AfxGetStkReceiver().CreateReceiver(m_pMainWnd); AfxGetStkReceiver().NetEngineSetAutoReport(FALSE); /* Show Startup Window CStartupDlg startup; CBitmap bmp; bmp.LoadBitmap(IDB_DLGLEFTLOGO); startup.SetBitmap((HBITMAP)bmp.GetSafeHandle()); startup.SetLoadProgramFunc(LoadProgram); if (IDOK != startup.DoModal()) { pMainFrame->SendMessage(WM_CLOSE); return FALSE; } //*/ /* Show Splash Window CSplashDlg splash; CBitmap bmp; bmp.LoadBitmap(IDB_SPLASH); splash.SetBitmap(HBITMAP(bmp.GetSafeHandle())); splash.Create(NULL, 0, AfxGetSView().GetU(), AfxGetSView().GetS(), AfxGetVersionString(), FALSE, 0, STKLIB_MAX_PROGRESS); splash.ShowWindow(SW_SHOW); splash.UpdateWindow(); LoadProgram(splash.GetSafeHwnd(), 0, STKLIB_MAX_PROGRESS); splash.DestroyWindow(); //*/ // ////////////////////////////////////////////////////////////// // Open Simulation Strategy if (GetFirstStrategyPosition() == NULL) { if (OpenLastOpenedStrategy() == 0) OpenDefaultStrategy(); } //if (!AfxGetStaticDoc()->GetViewIfExist(RUNTIME_CLASS(CSListView))) // AfxGetStaticDoc()->ShowStaticView(RUNTIME_CLASS(CSListView), TRUE); //AfxSwitchToStaticView(RUNTIME_CLASS(CSListView)); AfxGetProfile().SetCurrentStock(STKLIB_CODE_SZZS, FALSE); ((CMainFrame*)m_pMainWnd)->m_SearchBox.InitStocks( TRUE, TRUE, TRUE ); ((CMainFrame*)m_pMainWnd)->m_SearchBox.SetCurrentWindowText(); //*////////////////////////////////////////////////////////////// // Dispatch commands specified on the command line if( CCommandLineInfo::AppUnregister == cmdInfo.m_nShellCommand ) { AfxUnregisterShellFileTypes(); if (!cmdInfo.m_bRunEmbedded) AfxMessageBox(AFX_IDP_UNREG_DONE, MB_OK | MB_ICONINFORMATION); if (m_pCmdInfo == NULL) { m_pCmdInfo = new CCommandLineInfo; m_pCmdInfo->m_nShellCommand = CCommandLineInfo::AppUnregister; } return FALSE; } // Dispatch commands specified on the command line if (cmdInfo.m_nShellCommand == CCommandLineInfo::FileOpen) { OpenStrategyFile(cmdInfo.m_strFileName); AfxSwitchToStaticView(RUNTIME_CLASS(CSimuView)); } // 启动通视接收系统,不显示选择接收系统对话框 //AfxGetStkReceiver().EngineBeginWorking(FALSE); // The one and only window has been initialized, so show and update it. // Load Last WindowPlacement WINDOWPLACEMENT wp; if (AfxGetProfile().GetWindowPlacement(&wp)) m_pMainWnd->SetWindowPlacement(&wp); else m_pMainWnd->ShowWindow(SW_SHOWMAXIMIZED); // Enable drag/drop open //m_pMainWnd->DragAcceptFiles(); // Check New Version m_pMainWnd->SetTimer(TIMER_AUTOUPDATE, 5000, NULL); return TRUE; }
BOOL CALLBACK LoadProgram( HWND hWnd, int nMinProgress, int nMaxProgress ) { int nMin = nMinProgress; int nMax = nMaxProgress; int nRange = nMaxProgress-nMinProgress; CStkUIApp * pApp = AfxGetStkUIApp(); if( NULL == pApp ) return FALSE; CStaticDoc * pStaticDoc = pApp->GetStaticDoc(); CMainFrame * pMainFrame = AfxGetMainFrame(); HINSTANCE hInstanceOld = AfxGetResourceHandle(); AfxSetResourceHandle( AfxGetInstanceHandle() ); SendMessage( hWnd, WM_USER_STARTUP_PROGRESS, nMin, 0 ); AfxGetStockContainer().Load( &AfxGetDB(), NULL, NULL ); AfxGetDomainContainer().Load( AfxGetProfile().GetDomainFile() ); AfxGetGroupContainer().Load( AfxGetProfile().GetGroupFile() ); SendMessage( hWnd, WM_USER_STARTUP_PROGRESS, nMin+nRange*4/30, 0 ); pMainFrame->m_SearchBox.InitStocks( TRUE, TRUE, TRUE ); //pMainFrame->m_DateBox.InitDates( ); SendMessage( hWnd, WM_USER_STARTUP_PROGRESS, nMin+nRange*8/30, 0 ); // Open Simulation Strategy if( NULL == pApp->GetFirstStrategyPosition() ) { if( 0 == pApp->OpenLastOpenedStrategy( ) ) pApp->OpenDefaultStrategy( ); } SendMessage( hWnd, WM_USER_STARTUP_PROGRESS, nMin+nRange*12/30, 0 ); // Show Views //if( !pStaticDoc->GetViewIfExist( RUNTIME_CLASS(CWizardView) ) ) // pStaticDoc->ShowStaticView( RUNTIME_CLASS(CWizardView), TRUE ); //SendMessage( hWnd, WM_USER_STARTUP_PROGRESS, nMin+nRange*14/30, 0 ); //if( !pStaticDoc->GetViewIfExist( RUNTIME_CLASS(CSimuView) ) ) // pStaticDoc->ShowStaticView( RUNTIME_CLASS(CSimuView), TRUE ); //SendMessage( hWnd, WM_USER_STARTUP_PROGRESS, nMin+nRange*16/30, 0 ); if( !pStaticDoc->GetViewIfExist( RUNTIME_CLASS(CSListView) ) ) pStaticDoc->ShowStaticView( RUNTIME_CLASS(CSListView), TRUE ); SendMessage( hWnd, WM_USER_STARTUP_PROGRESS, nMin+nRange*18/30, 0 ); //if( !pStaticDoc->GetViewIfExist( RUNTIME_CLASS(CRealTimeView) ) ) // pStaticDoc->ShowStaticView( RUNTIME_CLASS(CRealTimeView), TRUE ); //SendMessage( hWnd, WM_USER_STARTUP_PROGRESS, nMin+nRange*20/30, 0 ); //if( !pStaticDoc->GetViewIfExist( RUNTIME_CLASS(CMultiSortView) ) ) // pStaticDoc->ShowStaticView( RUNTIME_CLASS(CMultiSortView), TRUE ); //SendMessage( hWnd, WM_USER_STARTUP_PROGRESS, nMin+nRange*22/30, 0 ); //if( !pStaticDoc->GetViewIfExist( RUNTIME_CLASS(CGraphView) ) ) // pStaticDoc->ShowStaticView( RUNTIME_CLASS(CGraphView), TRUE ); //SendMessage( hWnd, WM_USER_STARTUP_PROGRESS, nMin+nRange*24/30, 0 ); //if( !pStaticDoc->GetViewIfExist( RUNTIME_CLASS(CBaseView) ) ) // pStaticDoc->ShowStaticView( RUNTIME_CLASS(CBaseView), TRUE ); //SendMessage( hWnd, WM_USER_STARTUP_PROGRESS, nMin+nRange*26/30, 0 ); //if( !pStaticDoc->GetViewIfExist( RUNTIME_CLASS(CInfoView) ) ) // pStaticDoc->ShowStaticView( RUNTIME_CLASS(CInfoView), TRUE ); //SendMessage( hWnd, WM_USER_STARTUP_PROGRESS, nMin+nRange*28/30, 0 ); //if( !pStaticDoc->GetViewIfExist( RUNTIME_CLASS(CSelectorView) ) ) // pStaticDoc->ShowStaticView( RUNTIME_CLASS(CSelectorView), TRUE ); AfxSwitchToStaticView( RUNTIME_CLASS(CSListView) ); AfxGetProfile().SetCurrentStock( STKLIB_CODE_SZZS, FALSE ); pMainFrame->m_SearchBox.SetCurrentWindowText( ); //pMainFrame->m_DateBox.SetWindowPos(NULL,0,0,135,200,SWP_NOMOVE|SWP_SHOWWINDOW|SWP_NOZORDER|SWP_NOREDRAW); AfxBeginThread( LoadKDataCacheMain, NULL, THREAD_PRIORITY_NORMAL); SendMessage( hWnd, WM_USER_STARTUP_PROGRESS, nMax, 0 ); AfxSetResourceHandle( hInstanceOld ); return TRUE; }