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

📄 studentcard.cpp

📁 北京航空航天大学指纹识别系统源码
💻 CPP
字号:
// Studentcard.cpp : implementation file
//

#include "stdafx.h"
#include "FingerDemo.h"
#include "Studentcard.h"
#include "MbtoIC.h"

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

/////////////////////////////////////////////////////////////////////////////
// CStudentcard dialog


CStudentcard::CStudentcard(CWnd* pParent /*=NULL*/)
	: CDialog(CStudentcard::IDD, pParent)
{
	//{{AFX_DATA_INIT(CStudentcard)
	m_age = _T("");
	m_idno = _T("");
	m_name = _T("");
	//}}AFX_DATA_INIT
}


void CStudentcard::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CStudentcard)
	DDX_Text(pDX, IDC_AGE, m_age);
	DDV_MaxChars(pDX, m_age, 3);
	DDX_Text(pDX, IDC_IDNO, m_idno);
	DDV_MaxChars(pDX, m_idno, 20);
	DDX_Text(pDX, IDC_NAME, m_name);
	DDV_MaxChars(pDX, m_name, 20);
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CStudentcard, CDialog)
	//{{AFX_MSG_MAP(CStudentcard)
	ON_BN_CLICKED(IDC_CLEAR, OnClear)
	ON_BN_CLICKED(IDC_ISSUE, OnIssue)
	ON_BN_CLICKED(IDC_READ, OnRead)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CStudentcard message handlers

void CStudentcard::OnClear() 
{
	// TODO: Add your control notification handler code here
	m_name = "";
	m_age = "";
	m_idno = "";
	UpdateData(false);

}

void CStudentcard::OnIssue() 
{
	// TODO: Add your control notification handler code here
	//write infomation: name=20bytes; age=3bytes;idno=20bytes
	CMbtoIC m_issue;
	int i;
	unsigned char byte_info[43];

	UpdateData(true);

	for(i=0;i<43;i++)	//set to 00
	{
		byte_info[i] = 0;
	}	
	for(i=0;i<m_name.GetLength();i++) //name=20bytes
	{
	    byte_info[i] = m_name[i];
	}
	for(i=0;i<m_age.GetLength();i++)	//age=3bytes
	{
		byte_info[i+20] = m_age[i];
	}
	for(i=0;i<m_idno.GetLength();i++)	//idno=20bytes
	{
		byte_info[i+23] = m_idno[i];
	}

	if(m_issue.Issuestudent(byte_info))
	{
		AfxMessageBox("发学生卡成功!");
	}

}

void CStudentcard::OnRead() 
{
	// TODO: Add your control notification handler code here
	CMbtoIC m_issue;
	int i;
	unsigned char byte_info[43];

	m_issue.Readinfo(byte_info);

	m_name="";
	for(i=0;byte_info[i]!=0&&i<20;i++) //name=20bytes
	{
	    m_name+=byte_info[i];
	}
	
	m_age="";
	for(i=0;byte_info[i+20]!=0&&i<3;i++) //age=20bytes
	{
	    m_age+=byte_info[i+20];
	}

	m_idno="";
	for(i=0;byte_info[i+23]!=0&&i<20;i++) //idno=20bytes
	{
	    m_idno+=byte_info[i+23];
	}

	UpdateData(false);
}

⌨️ 快捷键说明

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