// DLG_HDQuery.cpp : implementation file // #include "stdafx.h" #include "corpsms.h" #include "DLG_HDQuery.h" #ifdef _DEBUG #define new DEBUG_NEW #undef THIS_FILE static char THIS_FILE[] = __FILE__; #endif ///////////////////////////////////////////////////////////////////////////// // DLG_HDQuery dialog #include "MainFrm.h" DLG_HDQuery::DLG_HDQuery(CWnd* pParent /*=NULL*/) : CDialog(DLG_HDQuery::IDD, pParent) { //{{AFX_DATA_INIT(DLG_HDQuery) // NOTE: the ClassWizard will add member initialization here //}}AFX_DATA_INIT m_pAdoRS = NULL; m_pMainFrame = (CMainFrame *)pParent; } void DLG_HDQuery::DoDataExchange(CDataExchange* pDX) { CDialog::DoDataExchange(pDX); //{{AFX_DATA_MAP(DLG_HDQuery) DDX_Control(pDX, IDC_HDQUERY_MOBILE, m_E_Mobile); DDX_Control(pDX, IDC_HDQUERY_CITY, m_E_City); //}}AFX_DATA_MAP } BEGIN_MESSAGE_MAP(DLG_HDQuery, CDialog) //{{AFX_MSG_MAP(DLG_HDQuery) //}}AFX_MSG_MAP END_MESSAGE_MAP() ///////////////////////////////////////////////////////////////////////////// // DLG_HDQuery message handlers void DLG_HDQuery::SetParam(CAdoRecordSet *pAdoRS) { m_pAdoRS = pAdoRS; } void DLG_HDQuery::OnOK() { CString strMobile; m_E_Mobile.GetWindowText(strMobile); if ( strMobile.GetLength()<7 ) { MessageBox( _T("输入的手机号段长度过短,最少要7位!") , _T("错误"), MB_ICONWARNING ); GetDlgItem(IDC_HDQUERY_MOBILE)->SetFocus(); return ; } // if ( strMobile.GetLength()>7 ) // strMobile = strMobile.Left(7); m_E_City.SetWindowText(_T("")); REQ_GetHD * pHD = new REQ_GetHD; memset(pHD , 0 , sizeof(REQ_GetHD)); _tcscpy(pHD->szHD , strMobile); m_pMainFrame->SendFrame( SMSFUNC_GETHD , (BYTE*)pHD , sizeof(REQ_GetHD) ); /* CString str; CString strProvince=_T("未知归属地"); CString strCity=_T(""); str.Format( _T("select * from HDB where Head='%s'"),strMobile); if ( m_pAdoRS->Open(str) && m_pAdoRS->GetRecordCount()>0 ) { m_pAdoRS->MoveFirst(); m_pAdoRS->GetCollect( _T("Province") , strProvince ); m_pAdoRS->GetCollect( _T("City") , strCity ); m_pAdoRS->Close(); } if ( strCity.GetLength()>0 ) strProvince = strProvince+"-"+strCity; m_E_City.SetWindowText(strProvince); return ; CDialog::OnOK(); */ } BOOL DLG_HDQuery::OnInitDialog() { CDialog::OnInitDialog(); m_E_Mobile.LimitText(16); return TRUE; // return TRUE unless you set the focus to a control // EXCEPTION: OCX Property Pages should return FALSE } void DLG_HDQuery::SetHDMsg(CString strMsg) { m_E_City.SetWindowText(strMsg); }