Home > Net >  Small white have a headache, do something for me, thank you
Small white have a headache, do something for me, thank you

Time:09-18

Doing a read id program, requirements to realize automatic identification card on card reader, if you don't move do not read on, if you took away after put up again, then to read, don't know how to write, here's a card read class
Public static RdCardModel ReadCard ()
{

RdCardModel model=null;
String PCMD=Char. ConvertFromUtf32 (0 x41);
The string result=Application. StartupPath + "\ ";

Int arg0=0;
Int arg1=8811;
Byte [] arg2={0 x02, 0 x27, 0 x00 to 0 x00};
//initialize the port
Int FLG=ReadCardAPI64. UCommand1 (PCMD, ref arg0, ref arg1, arg2);
//verification card
X43 PCMD=Char. ConvertFromUtf32 (0);
Int flg2=ReadCardAPI64. UCommand1 (PCMD, ref arg0, ref arg1, arg2);
//read card
X46 PCMD=Char. ConvertFromUtf32 (0);
Int flg3=ReadCardAPI64. UCommand1 (PCMD, ref arg0, ref arg1, Encoding, GetEncoding (" GBK "). GetBytes (result);
If (flg3==62171 | | flg3==62172 | | flg3==62173)
{
//read identify id information, and save the model object, easy to use
The model=GetCardInfo ();
}
//close the connection
X42 PCMD=Char. ConvertFromUtf32 (0);
Int closeFlag=ReadCardAPI64. UCommand1 (PCMD, ref arg0, ref arg1, arg2);
Return the model;

}

Card is written in the TIMER attribute, reading class, or write on the form? Reading card form part of the statement below
Public partial class Form1: Form
{
Public _click ()
{
InitializeComponent ();
}


Private void Form1_Load (object sender, EventArgs e)
{
Timer1. Interval=30;//TIME method to write here right?
}

Private void timer1_Tick (object sender, EventArgs e)//TIME method to write here right?

{

Bool in64bit=(IntPtr. Size==8);
RdCardModel model=null;



If (in64bit)
{
The model=ReadCardInfo. ReadCard ();
}
The else
{
The model=ReadCardInfo. ReadCard86 ();
}
If (model!=null)
{
TextBox2. Text="";
String NA=the string. Format (model, NAME);
TextBox2. Text=NA;
TextBox3. Text="";
String SE=the string. Format (" {0} ", model. SEX);
If (SE=="1")
SE="male";
The else
SE="female";
TextBox3. Text=SE;
}
}
}

CodePudding user response:

This should not be directly according to the manufacturer's document to you,,

CodePudding user response:

This generally want to use thread to listen on port,
  •  Tags:  
  • C#
  • Related