📄 srchcertificate_ppage.cpp
字号:
// SrchCertificate_PPage.cpp : implementation file
//
#include "stdafx.h"
#include "TrafficExecLaw.h"
#include "SrchCertificate_PPage.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CSrchCertificate_PPage property page
IMPLEMENT_DYNCREATE(CSrchCertificate_PPage, CPropertyPage)
CSrchCertificate_PPage::CSrchCertificate_PPage() : CPropertyPage(CSrchCertificate_PPage::IDD)
{
//{{AFX_DATA_INIT(CSrchCertificate_PPage)
m_address = _T("");
m_born_date = _T("");
m_car_permission = _T("");
m_cer_mumber = _T("");
m_country = _T("");
m_date_get_cer_date = _T("");
m_name = _T("");
m_sex = _T("");
m_start_date = _T("");
m_curr_points = 0;
m_deducted_points = 0;
m_valid_date = 0;
//}}AFX_DATA_INIT
}
CSrchCertificate_PPage::~CSrchCertificate_PPage()
{
}
void CSrchCertificate_PPage::DoDataExchange(CDataExchange* pDX)
{
CPropertyPage::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CSrchCertificate_PPage)
DDX_Text(pDX, IDC_EDIT_address, m_address);
DDX_Text(pDX, IDC_EDIT_bornDate, m_born_date);
DDX_Text(pDX, IDC_EDIT_car_permission, m_car_permission);
DDX_Text(pDX, IDC_EDIT_CerNumber, m_cer_mumber);
DDX_Text(pDX, IDC_EDIT_country, m_country);
DDX_Text(pDX, IDC_EDIT_Get_Cer_Date, m_date_get_cer_date);
DDX_Text(pDX, IDC_EDIT_Name, m_name);
DDX_Text(pDX, IDC_EDIT_sex, m_sex);
DDX_Text(pDX, IDC_EDIT_start_date, m_start_date);
DDX_Text(pDX, IDC_EDIT_current_point, m_curr_points);
DDX_Text(pDX, IDC_EDIT_deducted_points, m_deducted_points);
DDX_Text(pDX, IDC_EDIT_valid_date, m_valid_date);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CSrchCertificate_PPage, CPropertyPage)
//{{AFX_MSG_MAP(CSrchCertificate_PPage)
ON_BN_CLICKED(IDC_BUTTON_QUERY, OnButtonQuery)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
int WriteICC(int offset,void *buf,int len)
{
HANDLE m_hIC;
DWORD bytesWrt;
m_hIC = CreateFile(TEXT("ICC1:"),
GENERIC_READ | GENERIC_WRITE,
0, // comm devices must be opened w/exclusive-access
NULL, // no security attributes
OPEN_EXISTING, // comm devices must use OPEN_EXISTING
0, // not overlapped I/O
NULL // hTemplate must be NULL for comm devices
);
if(m_hIC==INVALID_HANDLE_VALUE )
return 0;
SetFilePointer(m_hIC,offset,NULL,FILE_BEGIN);
WriteFile(m_hIC,buf,len,&bytesWrt,NULL);
::CloseHandle (m_hIC);
return bytesWrt;
}
int ReadICC(int offset,void *buf,int len)
{
HANDLE m_hIC;
DWORD bytesRed;
int all=0;
m_hIC = CreateFile(TEXT("ICC1:"),
GENERIC_READ | GENERIC_WRITE,
0, // comm devices must be opened w/exclusive-access
NULL, // no security attributes
OPEN_EXISTING, // comm devices must use OPEN_EXISTING
0, // not overlapped I/O
NULL // hTemplate must be NULL for comm devices
);
if(m_hIC==INVALID_HANDLE_VALUE )
return 0;
SetFilePointer(m_hIC,offset,NULL,FILE_BEGIN);
ReadFile(m_hIC,buf,len,&bytesRed,NULL);
::CloseHandle (m_hIC);
return bytesRed;
}
/////////////////////////////////////////////////////////////////////////////
// CSrchCertificate_PPage message handlers
void CSrchCertificate_PPage::OnButtonQuery()
{
Drive_Certi_Info dci;
if(::ReadICC (32,&dci,sizeof(dci))==0)
{
MessageBox(L"读取IC卡错误。");
return;
}
m_address = dci.m_address;
m_born_date =dci.m_born_date;
m_car_permission = dci.m_car_permission;
m_cer_mumber =dci.m_cer_mumber;
m_country = dci.m_country;
m_curr_points = dci.m_curr_points;
m_deducted_points = dci.m_deducted_points;
m_date_get_cer_date = dci.m_date_get_cer_date;
m_name = dci.m_name;
m_sex = dci.m_sex;
m_start_date = dci.m_start_date;
m_valid_date = dci.m_valid_date;
this->UpdateData (false);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -