⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 sndlg.cpp

📁 代码为windows下的无线猫的应用程序(对AT指令的操作)。
💻 CPP
字号:
// SNDlg.cpp : implementation file
//

#include "stdafx.h"
#include "SIMTOOL.h"
#include "SNDlg.h"

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

/////////////////////////////////////////////////////////////////////////////
// CSNDlg dialog

extern CSIMTOOLApp theApp;

CSNDlg::CSNDlg(CWnd* pParent /*=NULL*/)
	: CDialog(CSNDlg::IDD, pParent)
{
	//{{AFX_DATA_INIT(CSNDlg)
	m_SN1 = _T("");
	m_SN2 = _T("");
	m_SN3 = _T("");
	m_SN4 = _T("");
	m_SN5 = _T("");
	//}}AFX_DATA_INIT
}


void CSNDlg::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CSNDlg)
	DDX_Text(pDX, IDC_SN1, m_SN1);
	DDV_MaxChars(pDX, m_SN1, 5);
	DDX_Text(pDX, IDC_SN2, m_SN2);
	DDV_MaxChars(pDX, m_SN2, 5);
	DDX_Text(pDX, IDC_SN3, m_SN3);
	DDV_MaxChars(pDX, m_SN3, 5);
	DDX_Text(pDX, IDC_SN4, m_SN4);
	DDV_MaxChars(pDX, m_SN4, 5);
	DDX_Text(pDX, IDC_SN5, m_SN5);
	DDV_MaxChars(pDX, m_SN5, 5);
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CSNDlg, CDialog)
	//{{AFX_MSG_MAP(CSNDlg)
	ON_WM_CTLCOLOR()
	ON_EN_CHANGE(IDC_SN1, OnChangeSn1)
	ON_EN_CHANGE(IDC_SN2, OnChangeSn2)
	ON_EN_CHANGE(IDC_SN3, OnChangeSn3)
	ON_EN_CHANGE(IDC_SN4, OnChangeSn4)
	ON_EN_CHANGE(IDC_SN5, OnChangeSn5)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CSNDlg message handlers

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

void CSNDlg::OnOK() 
{
	// TODO: Add extra validation here
	char sn[255];

	UpdateData(TRUE);
	memset(sn, 0, 255);
	sprintf(sn, "%s%s%s%s%s", m_SN1, m_SN2, m_SN3, m_SN4, m_SN5);
	if (strlen(sn) != 25)
	{
		GetDlgItem(IDC_SN1)->SetFocus();
		MessageBox("请填写注册码", "AWS");
		return;
	}
	else
	{
		theApp.SetRegSN(sn);
	}

	CDialog::OnOK();
}

HBRUSH CSNDlg::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor) 
{
	HBRUSH hbr = CDialog::OnCtlColor(pDC, pWnd, nCtlColor);
	
	// TODO: Change any attributes of the DC here
	
	// TODO: Return a different brush if the default is not desired
	return hbr;
}

void CSNDlg::OnChangeSn1() 
{
	// TODO: If this is a RICHEDIT control, the control will not
	// send this notification unless you override the CDialog::OnInitDialog()
	// function and call CRichEditCtrl().SetEventMask()
	// with the ENM_CHANGE flag ORed into the mask.
	
	// TODO: Add your control notification handler code here
	UpdateData(TRUE);

	if (m_SN1.GetLength() == 5)
	{
		GetDlgItem(IDC_SN2)->SetFocus();
	}
}

void CSNDlg::OnChangeSn2() 
{
	// TODO: If this is a RICHEDIT control, the control will not
	// send this notification unless you override the CDialog::OnInitDialog()
	// function and call CRichEditCtrl().SetEventMask()
	// with the ENM_CHANGE flag ORed into the mask.
	
	// TODO: Add your control notification handler code here
	UpdateData(TRUE);

	if (m_SN2.GetLength() == 5)
	{
		GetDlgItem(IDC_SN3)->SetFocus();
	}
}

void CSNDlg::OnChangeSn3() 
{
	// TODO: If this is a RICHEDIT control, the control will not
	// send this notification unless you override the CDialog::OnInitDialog()
	// function and call CRichEditCtrl().SetEventMask()
	// with the ENM_CHANGE flag ORed into the mask.
	
	// TODO: Add your control notification handler code here
	UpdateData(TRUE);

	if (m_SN3.GetLength() == 5)
	{
		GetDlgItem(IDC_SN4)->SetFocus();
	}
}

void CSNDlg::OnChangeSn4() 
{
	// TODO: If this is a RICHEDIT control, the control will not
	// send this notification unless you override the CDialog::OnInitDialog()
	// function and call CRichEditCtrl().SetEventMask()
	// with the ENM_CHANGE flag ORed into the mask.
	
	// TODO: Add your control notification handler code here
	UpdateData(TRUE);

	if (m_SN4.GetLength() == 5)
	{
		GetDlgItem(IDC_SN5)->SetFocus();
	}
}

void CSNDlg::OnChangeSn5()
{
	// TODO: If this is a RICHEDIT control, the control will not
	// send this notification unless you override the CDialog::OnInitDialog()
	// function and call CRichEditCtrl().SetEventMask()
	// with the ENM_CHANGE flag ORed into the mask.
	
	// TODO: Add your control notification handler code here
	UpdateData(TRUE);

	if (m_SN5.GetLength() == 5)
	{
		GetDlgItem(IDOK)->SetFocus();
	}
}

⌨️ 快捷键说明

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