MonitorDlg.cpp
上传用户:yffx2008
上传日期:2014-10-12
资源大小:12414k
文件大小:2k
- // MonitorDlg.cpp : implementation file
- //
- #include "stdafx.h"
- #include "GpsSC.h"
- #include "MonitorDlg.h"
- #include "ClientinfoSet.h"
- #include "TreeCtrlEx.h"
- #ifdef _DEBUG
- #define new DEBUG_NEW
- #undef THIS_FILE
- static char THIS_FILE[] = __FILE__;
- #endif
- /////////////////////////////////////////////////////////////////////////////
- // CMonitorDlg dialog
- CMonitorDlg::CMonitorDlg(CWnd* pParent /*=NULL*/)
- : CDialog(CMonitorDlg::IDD, pParent)
- {
- //{{AFX_DATA_INIT(CMonitorDlg)
- m_strMonitorTimeSpan = _T("");
- m_strVehicleNo = _T("");
- //}}AFX_DATA_INIT
- }
- void CMonitorDlg::DoDataExchange(CDataExchange* pDX)
- {
- CDialog::DoDataExchange(pDX);
- //{{AFX_DATA_MAP(CMonitorDlg)
- DDX_Control(pDX, IDC_TIMESPAN, m_ctrlTimeSpan);
- DDX_Control(pDX, IDC_VEHICLENO, m_ctrlVehicleNo);
- DDX_CBString(pDX, IDC_TIMESPAN, m_strMonitorTimeSpan);
- DDV_MaxChars(pDX, m_strMonitorTimeSpan, 2);
- DDX_CBString(pDX, IDC_VEHICLENO, m_strVehicleNo);
- //}}AFX_DATA_MAP
- }
- BEGIN_MESSAGE_MAP(CMonitorDlg, CDialog)
- //{{AFX_MSG_MAP(CMonitorDlg)
- //}}AFX_MSG_MAP
- END_MESSAGE_MAP()
- /////////////////////////////////////////////////////////////////////////////
- // CMonitorDlg message handlers
- BOOL CMonitorDlg::OnInitDialog()
- {
- CDialog::OnInitDialog();
-
- // TODO: Add extra initialization here
- CClientinfoSet clientinfoset;
- CString strVehicleNo;
- BOOL HasGetTreeItemText=false;
-
- try
- {
- if(!clientinfoset.IsOpen())
- clientinfoset.Open();
- while(!clientinfoset.IsEOF())
- {
- strVehicleNo='('+clientinfoset.m_CarNumber+')'+clientinfoset.m_CarPhone;
- m_ctrlVehicleNo.AddString(strVehicleNo);
- if((str_GetTreeItemText==clientinfoset.m_CarNumber)||(str_GetTreeItemText==clientinfoset.m_ClientName))
- {
- str_GetTreeItemText=strVehicleNo;
- HasGetTreeItemText=true;
- }
- clientinfoset.MoveNext();
- }
- }
- catch(CDBException *Exp)
- {
- AfxMessageBox(Exp->ReportError());
- }
- //设置在树形控件所选子项
- if(HasGetTreeItemText)
- (m_ctrlVehicleNo.FindStringExact(0, str_GetTreeItemText )==CB_ERR ) ?
- m_ctrlVehicleNo.SetCurSel (-1):
- m_ctrlVehicleNo.SetCurSel (m_ctrlVehicleNo.FindStringExact(0,str_GetTreeItemText));
- return TRUE; // return TRUE unless you set the focus to a control
- // EXCEPTION: OCX Property Pages should return FALSE
- }