DlgAsNormalDlg.cpp
上传用户:yffx2008
上传日期:2014-10-12
资源大小:12414k
文件大小:2k
- // DlgAsNormalDlg.cpp : implementation file
- //
- #include "stdafx.h"
- #include "GpsSC.h"
- #include "DlgAsNormalDlg.h"
- #include "ClientinfoSet.h"
- #ifdef _DEBUG
- #define new DEBUG_NEW
- #undef THIS_FILE
- static char THIS_FILE[] = __FILE__;
- #endif
- /////////////////////////////////////////////////////////////////////////////
- // CDlgAsNormalDlg dialog
- CDlgAsNormalDlg::CDlgAsNormalDlg(CWnd* pParent /*=NULL*/)
- : CDialog(CDlgAsNormalDlg::IDD, pParent)
- {
- //{{AFX_DATA_INIT(CDlgAsNormalDlg)
- m_strPassWord = _T("123456");
- m_strVehicleNo = _T("");
- //}}AFX_DATA_INIT
- }
- void CDlgAsNormalDlg::DoDataExchange(CDataExchange* pDX)
- {
- CDialog::DoDataExchange(pDX);
- //{{AFX_DATA_MAP(CDlgAsNormalDlg)
- DDX_Control(pDX, IDC_VEHICLENO, m_ctrlVehicleNo);
- DDX_Text(pDX, IDC_PASSWORD, m_strPassWord);
- DDV_MaxChars(pDX, m_strPassWord, 6);
- DDX_CBString(pDX, IDC_VEHICLENO, m_strVehicleNo);
- //}}AFX_DATA_MAP
- }
- BEGIN_MESSAGE_MAP(CDlgAsNormalDlg, CDialog)
- //{{AFX_MSG_MAP(CDlgAsNormalDlg)
- ON_WM_CANCELMODE()
- //}}AFX_MSG_MAP
- END_MESSAGE_MAP()
- /////////////////////////////////////////////////////////////////////////////
- // CDlgAsNormalDlg message handlers
- BOOL CDlgAsNormalDlg::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();
- }
- clientinfoset.Close();
- }
- catch(CDBException* pEx)
- {
- AfxMessageBox(pEx->ReportError());
- clientinfoset.Close();
- }
- //设置在树形控件所选子项
- 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
- }