www.gusucode.com > 铁路列车车辆监控系统本系统要求PC机有两个串行通讯串口, > 铁路列车车辆监控系统本系统要求PC机有两个串行通讯串口,有线MODEM一个。其它配置没有严格的要求,一般配置即可。/铁路列车车辆监控系统/电子地图显示模块(江军)/EagleViewNew/MainFrm.cpp
// MainFrm.cpp : implementation of the CMainFrame class // #include "stdafx.h" #include "EagleView.h" #include "MainFrm.h" #include "EagleViewView.h" #include "EagleWnd.h" #include "InfoWnd.h" #ifdef _DEBUG #define new DEBUG_NEW #undef THIS_FILE static char THIS_FILE[] = __FILE__; #endif ///////////////////////////////////////////////////////////////////////////// // CMainFrame IMPLEMENT_DYNCREATE(CMainFrame, CFrameWnd) BEGIN_MESSAGE_MAP(CMainFrame, CFrameWnd) //{{AFX_MSG_MAP(CMainFrame) ON_WM_CREATE() ON_WM_TIMER() ON_UPDATE_COMMAND_UI(IDC_START, OnUpdateStart) ON_UPDATE_COMMAND_UI(IDC_STOP, OnUpdateStop) //}}AFX_MSG_MAP END_MESSAGE_MAP() static UINT indicators[] = { ID_SEPARATOR, // status line indicator IDS_JINGDU, IDS_WEIDU, IDS_TIME, }; ///////////////////////////////////////////////////////////////////////////// // CMainFrame construction/destruction CMainFrame::CMainFrame() { // TODO: add member initialization code here m_Enabled=TRUE; } CMainFrame::~CMainFrame() { } int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct) { if (CFrameWnd::OnCreate(lpCreateStruct) == -1) return -1; if (!m_wndToolBar.CreateEx(this, TBSTYLE_FLAT, WS_CHILD | WS_VISIBLE | CBRS_TOP | CBRS_GRIPPER | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC) || !m_wndToolBar.LoadToolBar(IDR_MAINFRAME)) { TRACE0("Failed to create toolbar\n"); return -1; // fail to create } if (!m_wndStatusBar.Create(this) || !m_wndStatusBar.SetIndicators(indicators, sizeof(indicators)/sizeof(UINT))) { TRACE0("Failed to create status bar\n"); return -1; // fail to create } // TODO: Delete these three lines if you don't want the toolbar to // be dockable m_wndToolBar.EnableDocking(CBRS_ALIGN_ANY); EnableDocking(CBRS_ALIGN_ANY); DockControlBar(&m_wndToolBar); SetTimer(1,1000,NULL);//1秒 return 0; } BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs) { if( !CFrameWnd::PreCreateWindow(cs) ) return FALSE; // TODO: Modify the Window class or styles here by modifying // the CREATESTRUCT cs cs.style=WS_OVERLAPPED|WS_CAPTION|FWS_ADDTOTITLE|WS_THICKFRAME|WS_SYSMENU|WS_MINIMIZEBOX |WS_MAXIMIZEBOX|WS_MAXIMIZE; return TRUE; } ///////////////////////////////////////////////////////////////////////////// // CMainFrame diagnostics #ifdef _DEBUG void CMainFrame::AssertValid() const { CFrameWnd::AssertValid(); } void CMainFrame::Dump(CDumpContext& dc) const { CFrameWnd::Dump(dc); } #endif //_DEBUG ///////////////////////////////////////////////////////////////////////////// // CMainFrame message handlers BOOL CMainFrame::OnCreateClient(LPCREATESTRUCT lpcs, CCreateContext* pContext) { // TODO: Add your specialized code here and/or call the base class m_SplitterH.CreateStatic(this,1,2); m_SplitterV.CreateStatic(&m_SplitterH,2,1,WS_CHILD|WS_VISIBLE,m_SplitterH.IdFromRowCol(0,1)); m_SplitterH.CreateView(0,0,RUNTIME_CLASS(CEagleViewView),CSize(800,800),pContext); m_SplitterV.CreateView(0,0,RUNTIME_CLASS(CInfoWnd),CSize(450,450),pContext); m_SplitterV.CreateView(1,0,RUNTIME_CLASS(CEagleWnd),CSize(450,450),pContext); SetActiveView((CView*)m_SplitterH.GetPane(0,0)); return TRUE; //return CFrameWnd::OnCreateClient(lpcs, pContext); } void CMainFrame::OnTimer(UINT nIDEvent) { // TODO: Add your message handler code here and/or call default CTime t=CTime::GetCurrentTime(); CString str=t.Format("%H:%M:%S"); CClientDC dc(this); CSize sz=dc.GetTextExtent(str); m_wndStatusBar.SetPaneInfo(3,IDS_TIME,SBPS_NORMAL,sz.cx); m_wndStatusBar.SetPaneText(3,str); CFrameWnd::OnTimer(nIDEvent); } void CMainFrame::OnUpdateStart(CCmdUI* pCmdUI) { // TODO: Add your command update UI handler code here //pCmdUI->Enable(TRUE); pCmdUI->Enable(m_Enabled); } void CMainFrame::OnUpdateStop(CCmdUI* pCmdUI) { // TODO: Add your command update UI handler code here //pCmdUI->Enable(FALSE); pCmdUI->Enable(!m_Enabled); }