// DLG_Send_User.cpp : implementation file // #include "stdafx.h" #include "CorpSms.h" #include "DLG_Send_User.h" #ifdef _DEBUG #define new DEBUG_NEW #undef THIS_FILE static char THIS_FILE[] = __FILE__; #endif ///////////////////////////////////////////////////////////////////////////// // DLG_Send_User dialog DLG_Send_User::DLG_Send_User(CWnd* pParent /*=NULL*/) : CDialog(DLG_Send_User::IDD, pParent) { //{{AFX_DATA_INIT(DLG_Send_User) m_strBZ = _T(""); m_strMobile = _T(""); m_strName = _T(""); m_strNickName = _T(""); //}}AFX_DATA_INIT memset( &m_User , 0 , sizeof(m_User) ); m_lType = 0; } void DLG_Send_User::DoDataExchange(CDataExchange* pDX) { CDialog::DoDataExchange(pDX); //{{AFX_DATA_MAP(DLG_Send_User) DDX_Text(pDX, IDC_SEND_USER_BZ, m_strBZ); DDV_MaxChars(pDX, m_strBZ, 178); DDX_Text(pDX, IDC_SEND_USER_MOBILE, m_strMobile); DDV_MaxChars(pDX, m_strMobile, 18); DDX_Text(pDX, IDC_SEND_USER_NAME, m_strName); DDV_MaxChars(pDX, m_strName, 30); DDX_Text(pDX, IDC_SEND_USER_NICKNAME, m_strNickName); DDV_MaxChars(pDX, m_strNickName, 30); //}}AFX_DATA_MAP } BEGIN_MESSAGE_MAP(DLG_Send_User, CDialog) //{{AFX_MSG_MAP(DLG_Send_User) //}}AFX_MSG_MAP END_MESSAGE_MAP() ///////////////////////////////////////////////////////////////////////////// // DLG_Send_User message handlers void DLG_Send_User::SetParam(Send_User user) { m_User = user; } Send_User DLG_Send_User::GetParam() { return m_User; } BOOL DLG_Send_User::OnInitDialog() { CDialog::OnInitDialog(); m_strName = m_User.szName; m_strNickName = m_User.szNickName; m_strMobile = m_User.szMobile; m_strBZ = m_User.szBZ; UpdateData( false ); if ( m_lType == 2 ) //传真 { GetDlgItem(IDC_SEND_USER_NICKNAME)->EnableWindow(false); GetDlgItem(IDC_SEND_USER_BZ)->EnableWindow(false); GetDlgItem(IDC_SEND_USER_MOBILE_S)->SetWindowText(_T("传真")); } if ( m_lType == 3 ) //彩信 { GetDlgItem(IDC_SEND_USER_NICKNAME)->EnableWindow(false); GetDlgItem(IDC_SEND_USER_BZ)->EnableWindow(false); } if ( m_lType == 4 ) //QQ通讯录 { GetDlgItem(IDC_SEND_USER_NICKNAME)->EnableWindow(false); GetDlgItem(IDC_SEND_USER_BZ)->EnableWindow(false); } #ifdef UNICODE ((CEdit*)GetDlgItem(IDC_SEND_USER_BZ))->LimitText(MAX_MSG_LEN_UNI); #else ((CEdit*)GetDlgItem(IDC_SEND_USER_BZ))->LimitText(MAX_MSG_LEN); #endif #ifdef CHINABANK_VER ((CEdit*)GetDlgItem(IDC_SEND_USER_BZ))->LimitText(MAX_MSG_LEN_UNI_BANK); #endif return TRUE; // return TRUE unless you set the focus to a control // EXCEPTION: OCX Property Pages should return FALSE } void DLG_Send_User::OnOK() { UpdateData( true ); BOOL bOK=true; switch(m_lType) { case 2: bOK = isFaxNum( (TCHAR*)(LPCTSTR)m_strMobile ); break; case 3: bOK = isMmsNum( (TCHAR*)(LPCTSTR)m_strMobile ); break; case 4: bOK = isMmsNum( (TCHAR*)(LPCTSTR)m_strMobile ); break; default: bOK = isMobileNum( (TCHAR*)(LPCTSTR)m_strMobile ); break; } if ( !bOK ) { if ( m_lType==2 ) MessageBox( _T("传真号码输入有误,请重输!"),_T("错误"),MB_ICONWARNING); else MessageBox( _T("手机号码输入有误,请重输!"),_T("错误"),MB_ICONWARNING); GetDlgItem(IDC_SEND_USER_MOBILE)->SetFocus(); return ; } if ( m_strNickName == _T("任务号码组") ) { MessageBox( _T("无法使用此昵称,请更换!"),_T("错误"),MB_ICONWARNING); GetDlgItem(IDC_SEND_USER_NICKNAME)->SetFocus(); return ; } _tcscpy( m_User.szName , m_strName ); _tcscpy( m_User.szNickName , m_strNickName ); _tcscpy( m_User.szMobile , m_strMobile ); _tcscpy( m_User.szBZ , m_strBZ ); CDialog::OnOK(); } void DLG_Send_User::SetEditType(long lType) { m_lType = lType; }