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

📄 setreader.cpp

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

#include "stdafx.h"
#include "FingerDemo.h"
#include "Setreader.h"
#include "Reader.h"
//#include "iccardcom.h"
#include "Samfkq_b.h"		//extern dll

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

extern CFingerDemoApp theApp;

/////////////////////////////////////////////////////////////////////////////
// CSetreader dialog


CSetreader::CSetreader(CWnd* pParent /*=NULL*/)
	: CDialog(CSetreader::IDD, pParent)
{
	//{{AFX_DATA_INIT(CSetreader)
		// NOTE: the ClassWizard will add member initialization here
	//}}AFX_DATA_INIT
}


void CSetreader::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CSetreader)
	DDX_Control(pDX, IDC_COMBO_COM, m_com);
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CSetreader, CDialog)
	//{{AFX_MSG_MAP(CSetreader)
	ON_BN_CLICKED(IDC_RESET, OnReset)
	ON_BN_CLICKED(IDC_SEARCH, OnSearch)
	ON_BN_CLICKED(IDC_CLOSEPORT, OnCloseport)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CSetreader message handlers

void CSetreader::OnReset()	//open port
{
	// TODO: Add your control notification handler code here
	//CReader m_Reader;
	//::SetCursor(AfxGetApp()->LoadStandardCursor(IDC_WAIT));
	//m_Reader.readerreset();
	//::SetCursor(AfxGetApp()->LoadStandardCursor(IDC_ARROW));
	CString m_str;
	m_com.GetLBText(m_com.GetCurSel(),m_str);  
	hCom = Init_Comm(m_str);
	theApp.g_hCom = hCom;

	
}

void CSetreader::OnSearch() 
{
	// TODO: Add your control notification handler code here
//	m_part3.m_hExecuteWnd = m_hWnd;
//	m_part3.cardnumber = 0;
//	m_part3.StartAnticollision();	
	BYTE length;
	BYTE* Buffer = new BYTE[128];	
	BYTE* csn = new BYTE[4];	
	BYTE* Param = new BYTE[4];
	BYTE* High_Inf = new BYTE[20];
	int ret;
	
	if(ret=Operate_B(hCom,1))			//return 0 indicates success
	{
		AfxMessageBox("Fail to search card!");
		return;
	}
	ret = Req_Wake_B(hCom,1,5,0,0,Buffer,&length);	
	if(ret==0)
	{
		csn = Buffer+1;
		ret = Select_Type_B(hCom,1,csn,0x00,0x07,0x01,0x01,
					High_Inf,Buffer,&length);
		if(ret)
		{
			AfxMessageBox("Fail to search card!");
			return;
		}
	}
	else
	{
		AfxMessageBox("Fail to search card!");
		return;
	}
	AfxMessageBox("Card searched successfully!");
	
}

void CSetreader::OnCloseport() //close port
{
	// TODO: Add your control notification handler code here
	Exit(hCom);
}

BOOL CSetreader::OnInitDialog() 
{
	CDialog::OnInitDialog();
	
	// TODO: Add extra initialization here
	m_com.AddString("COM1"); 
	m_com.AddString("COM2"); 
	m_com.AddString("COM3"); 
	m_com.AddString("COM4"); 
	m_com.SetCurSel(0); 
	
	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}

void CSetreader::OnOK() 
{
	// TODO: Add extra validation here
	
	CDialog::OnOK();
}

⌨️ 快捷键说明

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