SmsManager/DLG_QZSmsTD.cpp
2025-01-14 10:46:18 +08:00

130 lines
3.0 KiB
C++

// DLG_QZSmsTD.cpp : implementation file
//
#include "stdafx.h"
#include "smsmanager.h"
#include "DLG_QZSmsTD.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// DLG_QZSmsTD dialog
DLG_QZSmsTD::DLG_QZSmsTD(CWnd* pParent /*=NULL*/)
: CDialog(DLG_QZSmsTD::IDD, pParent)
{
//{{AFX_DATA_INIT(DLG_QZSmsTD)
m_lCMCC = -1;
m_lPHS = -1;
m_lUnicom = -1;
m_lOutAll_CMCC = -1;
m_lOutAll_PHS = -1;
m_lOutAll_Unicom = -1;
m_lOutAll_Telcom = -1;
m_lTelcom = -1;
//}}AFX_DATA_INIT
memset( m_szSMSTD , 0 , sizeof(m_szSMSTD));
memset( m_szSMSOutAll , 0 , sizeof(m_szSMSOutAll));
}
void DLG_QZSmsTD::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(DLG_QZSmsTD)
DDX_CBIndex(pDX, IDD_QZSMSTD_CMCC, m_lCMCC);
DDX_CBIndex(pDX, IDD_QZSMSTD_PHS, m_lPHS);
DDX_CBIndex(pDX, IDD_QZSMSTD_UNICOM, m_lUnicom);
DDX_CBIndex(pDX, IDD_QZSMSTD_OUTALL_CMCC, m_lOutAll_CMCC);
DDX_CBIndex(pDX, IDD_QZSMSTD_OUTALL_PHS, m_lOutAll_PHS);
DDX_CBIndex(pDX, IDD_QZSMSTD_OUTALL_UNICOM, m_lOutAll_Unicom);
DDX_CBIndex(pDX, IDD_QZSMSTD_OUTALL_TELCOM, m_lOutAll_Telcom);
DDX_CBIndex(pDX, IDD_QZSMSTD_TELCOM, m_lTelcom);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(DLG_QZSmsTD, CDialog)
//{{AFX_MSG_MAP(DLG_QZSmsTD)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// DLG_QZSmsTD message handlers
BOOL DLG_QZSmsTD::OnInitDialog()
{
CDialog::OnInitDialog();
m_lCMCC = m_szSMSTD[0]-'0';
if (m_lCMCC<0 || m_lCMCC>9 )
m_lCMCC = 0;
m_lUnicom = m_szSMSTD[1]-'0';
if (m_lUnicom<0 || m_lUnicom>9 )
m_lUnicom = 0;
m_lPHS = m_szSMSTD[2]-'0';
if (m_lPHS<0 || m_lPHS>9 )
m_lPHS = 0;
m_lTelcom = m_szSMSTD[3]-'0';
if (m_lTelcom<0 || m_lTelcom>9 )
m_lTelcom = 0;
m_lOutAll_CMCC = m_szSMSOutAll[0]-'0';
if (m_lOutAll_CMCC<0 || m_lOutAll_CMCC>2 )
m_lOutAll_CMCC = 0;
m_lOutAll_Unicom = m_szSMSOutAll[1]-'0';
if (m_lOutAll_Unicom<0 || m_lOutAll_Unicom>9 )
m_lOutAll_Unicom = 0;
m_lOutAll_PHS = m_szSMSOutAll[2]-'0';
if (m_lOutAll_PHS<0 || m_lOutAll_PHS>9 )
m_lOutAll_PHS = 0;
m_lOutAll_Telcom = m_szSMSOutAll[3]-'0';
if (m_lOutAll_Telcom<0 || m_lOutAll_Telcom>9 )
m_lOutAll_Telcom = 0;
UpdateData(false);
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
void DLG_QZSmsTD::SetParam(const TCHAR *pSmsTD,const TCHAR * pSmsOutAll)
{
_tcscpy( m_szSMSTD , pSmsTD );
_tcscpy( m_szSMSOutAll , pSmsOutAll );
}
void DLG_QZSmsTD::OnOK()
{
if ( !UpdateData(true) )
return ;
m_szSMSTD[0] = '0' + m_lCMCC;
m_szSMSTD[1] = '0' + m_lUnicom;
m_szSMSTD[2] = '0' + m_lPHS;
m_szSMSTD[3] = '0' + m_lTelcom;
m_szSMSTD[4] = 0;
m_szSMSOutAll[0] = '0' + m_lOutAll_CMCC;
m_szSMSOutAll[1] = '0' + m_lOutAll_Unicom;
m_szSMSOutAll[2] = '0' + m_lOutAll_PHS;
m_szSMSOutAll[3] = '0' + m_lOutAll_Telcom;
m_szSMSOutAll[4] = 0;
CDialog::OnOK();
}