addteldlg.cpp

来自「tc35i(GSM模块)的控制程序VC源码」· C++ 代码 · 共 79 行

CPP
79
字号
// AddTelDlg.cpp : implementation file
//

#include "stdafx.h"
#include "GSM_Ctrl_Prj.h"
#include "AddTelDlg.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CAddTelDlg dialog


CAddTelDlg::CAddTelDlg(CWnd* pParent /*=NULL*/)
	: CDialog(CAddTelDlg::IDD, pParent)
{
	//{{AFX_DATA_INIT(CAddTelDlg)
	m_telStr = _T("");
	m_nameStr = _T("");
	//}}AFX_DATA_INIT
}


void CAddTelDlg::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CAddTelDlg)
	DDX_Text(pDX, IDC_TELEDIT, m_telStr);
	DDX_Text(pDX, IDC_NAMEEDIT, m_nameStr);
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CAddTelDlg, CDialog)
	//{{AFX_MSG_MAP(CAddTelDlg)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CAddTelDlg message handlers

void CAddTelDlg::OnOK() 
{
	// TODO: Add extra validation here
		UpdateData(true);

	if(m_telStr.GetLength() == 0)
	{
		MessageBox("手机号不能为空!" , "警告" , MB_OK+MB_ICONWARNING);
		//m_telStr.SetFocus();
		return;
	}
	if(m_telStr.GetLength() != 11)
	{
		MessageBox("手机号位数不对!" , "警告" , MB_OK+MB_ICONWARNING);
		//m_telStr.SetFocus();
		return;
	}
	if(m_nameStr.GetLength() == 0)
		m_nameStr = " ";

	
	CDialog::OnOK();
}

BOOL CAddTelDlg::OnInitDialog() 
{
	CDialog::OnInitDialog();
	
	// TODO: Add extra initialization here
	UpdateData(false);
	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?