详细代码如下(如有疑问可13826029618进行咨询或者获取源代码)
//---------------------------------------------------------------------------
//广州荣士电子,定制13826029618 网址http://www.icmcu.com
#include <vcl.h>
#pragma hdrstop
#include "Unit1.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm1 *Form1;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
: TForm(Owner)
{
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button1Click(TObject *Sender)
//轻松读卡
{
/*
技术支持:
网站:
*/
unsigned char status;//存放返回值
unsigned char idserial[5]; //卡数据缓冲
unsigned char (__stdcall *idr_read)(unsigned char *serial);
//判断动态库是否存在
AnsiString FileName=ExtractFilePath(Application->ExeName);
if(FileName.SubString(FileName.Length(),1) != "//")
{
FileName += "//";
}
FileName += "OUR_IDR.dll";
if(!FileExists(FileName))
{
ShowMessage("无法在应用程序的文件夹找到OUR_IDR.dll");
return;
}
//提取函数
HINSTANCE hDll;
hDll=LoadLibrary(FileName.c_str());
idr_read = (unsigned char (__std