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

📄 chksc.cpp

📁 IC卡操作Demo 包括了常见的IC卡种类。可执行写入、读出、校验、密码修改、批量作业等功能。
💻 CPP
字号:
// ChkSc.cpp : implementation file
//

#include "stdafx.h"
#include "IcDemo.h"
#include "ChkSc.h"

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

/////////////////////////////////////////////////////////////////////////////
// CChkSc dialog


CChkSc::CChkSc(CWnd* pParent /*=NULL*/)
	: CDialog(CChkSc::IDD, pParent)
{
	//{{AFX_DATA_INIT(CChkSc)
	m_apz = _T("");
	m_pwd = _T("");
	m_rpwd = -1;
	m_rcls = -1;
	//}}AFX_DATA_INIT
}


void CChkSc::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CChkSc)
	DDX_Control(pDX, IDC_EDIT2, m_cpwd);
	DDX_Control(pDX, IDC_EDIT1, m_capz);
	DDX_Text(pDX, IDC_EDIT1, m_apz);
	DDV_MaxChars(pDX, m_apz, 2);
	DDX_Text(pDX, IDC_EDIT2, m_pwd);
	DDV_MaxChars(pDX, m_pwd, 6);
	DDX_Radio(pDX, IDC_RADIO1, m_rpwd);
	DDX_Radio(pDX, IDC_RADIO2, m_rcls);
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CChkSc, CDialog)
	//{{AFX_MSG_MAP(CChkSc)
	ON_WM_SHOWWINDOW()
	ON_BN_CLICKED(IDC_RADIO1, OnRadio1)
	ON_BN_CLICKED(IDC_RADIO2, OnRadio2)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CChkSc message handlers
extern CIcDemoApp theApp;

void CChkSc::OnShowWindow(BOOL bShow, UINT nStatus) 
{
	CDialog::OnShowWindow(bShow, nStatus);
	m_capz.SetFocus(); 
	// TODO: Add your message handler code here
	
}

BOOL CChkSc::OnInitDialog() 
{
	CDialog::OnInitDialog();
	
	// TODO: Add extra initialization here
	
	m_rpwd=0;
	m_apz="0";
	if(theApp.intType==42) 
	  m_pwd="FFFFFF";
    else
	  m_pwd="FFFF";
	UpdateData(FALSE);
	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}

void CChkSc::OnRadio1() 
{
	// TODO: Add your control notification handler code here
	m_rpwd=0;
	m_rcls=1;
	UpdateData(FALSE);
	m_capz.SetFocus(); 
}

void CChkSc::OnRadio2() 
{
	// TODO: Add your control notification handler code here
	m_rpwd=1;
	m_rcls=0;
    UpdateData(FALSE);
	m_capz.SetFocus(); 
}

void CChkSc::OnOK() 
{
	// TODO: Add extra validation here
	int Rn;
	char* chkSc=NULL;
	UpdateData(TRUE);
	if(m_apz.IsEmpty())
	{
	  m_capz.SetFocus();
	  return;
	}
	if(m_pwd.IsEmpty())
	{
	  m_cpwd.SetFocus();
	  return;
	}
	chkSc=new char[m_pwd.GetLength()+1];
	strcpy(chkSc,m_pwd);
	if(m_rpwd==0)
	{
     if(theApp.intType==42 || theApp.intType==43)  
	 {
	  Rn=theApp.surechk_sc(atoi(m_apz),m_pwd.GetLength()/2, chkSc);
	  if(Rn!=0)
		  theApp.ReadWriteError(Rn);
	  else
		  MessageBox("密码正确!","信息提示",MB_ICONINFORMATION|MB_OK);
	 }

	 }
	CDialog::OnOK();
}

⌨️ 快捷键说明

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