我把它自带的KLIC32.DLL改名为ic32.dll就可以用了, 但是我需要的是一份源程序不知哪位大侠以前开发过。
解决方案 »
- delphi xe 代码编辑器问题
- 求个delphi语言的md5计算函数
- 急呀;新手:望指教
- 如何让窗体运行后马上自动不可见
- 请推荐一个好用的pascal编译环境,初学用,最好是中文版
- 我怎么让一个实数保留两位小数,并且这样子。。。。。下面
- 在家都来探讨一下吧,这个问题比较难。
- 怎样把自已电脑的文件夹共享加密让在局域网内访问时要输入密码!象WIN98共享加密一样!!
- 为什么将Table的DataBaseName设置成“c:\db1.mdb”出错?????
- ListView(vsReport型)怎样将每行字符串透明地显示在背景图上?
- web application 中怎样在各个request请求中保存login是的用户名?
- 拨号网络中,如何对网络连接编写脚本?
你做的这个系统我也做了。要吗?[email protected]
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls, Buttons;type
TForm1 = class(TForm)
Button1: TButton;
readdata1: TEdit;
Label1: TLabel;
writedata: TEdit;
Label2: TLabel;
readdata2: TEdit;
Label3: TLabel;
Button2: TButton;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure FormDestroy(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;var
icdev: longint;
Form1: TForm1;
{a example for your to try using .dll. add_s return i+1}
function add_s(i: smallint): smallint; stdcall;
far;external 'ic32.DLL' name 'add_s';
{comm function.}
function IC_InitComm(port: smallint): longint; stdcall;
far;external 'ic32.DLL' name 'IC_InitComm';
function IC_ExitComm(icdev: longint):smallint;stdcall;
far;external 'ic32.dll'name 'IC_ExitComm';
function IC_Status(icdev: longint):smallint;stdcall;
far;external 'ic32.dll' name 'IC_Status';
function IC_InitType(icdev: longint; cardtype: smallint):smallint;stdcall;
far;external 'ic32.dll' name 'IC_InitType';
function IC_Write(icdev: longint;offset:smallint;len:smallint;databuff:pchar):smallint;stdcall;
far;external 'ic32.dll' name 'IC_Write';
function IC_Read(icdev:longint;offset:smallint;len:smallint;databuff:pchar):smallint;stdcall;
far;external 'ic32.dll' name 'IC_Read';
function IC_Erase(icdev:longint;offset:smallint;len:smallint):smallint;stdcall;
far;external 'ic32.dll' name 'IC_Erase';
function IC_Read_Float(icdev:longint;offset:smallint;fdata:pointer):smallint;stdcall;
far;external 'ic32.dll' name 'IC_Read_Float';
function IC_Write_Float(icdev:longint;offset:smallint;fdata:single):smallint;stdcall;
far;external 'ic32.dll' name 'IC_Write_Float';
function IC_Down(icdev:longint):smallint;stdcall;
far;external 'ic32.dll' name 'IC_Down';
function IC_Pushout(icdev:longint):smallint;stdcall;
far;external 'ic32.dll' name 'IC_Down';
{4442 function.}
function IC_ReadProtection(icdev:longint;offset:smallint;len:smallint;databuff:pchar):smallint;stdcall;
far;external 'ic32.dll' name 'IC_ReadProtection';
function IC_WriteProtection(icdev:longint;offset:smallint;len:smallint;databuff:pchar):smallint;stdcall;
far;external 'ic32.dll' name 'IC_WriteProtection';
function IC_ReadCount_SLE4442(icdev:longint):smallint;stdcall;
far;external 'ic32.dll' name 'IC_ReadCount_SLE4442';
function IC_CheckPass_SLE4442(icdev:longint;password:pchar):smallint;stdcall;
far;external 'ic32.dll' name 'IC_CheckPass_SLE4442';
function IC_ChangePass_SLE4442(icdev:longint;password:pchar):smallint;stdcall;
far;external 'ic32.dll' name 'IC_ChangePass_SLE4442';
{4428 function.}
function IC_ReadWithProtection(icdev:longint;offset:smallint;len:smallint;databuff:pchar):smallint;stdcall;
far;external 'ic32.dll' name 'IC_ReadWithProtection';
function IC_WriteWithProtection(icdev:longint;offset:smallint;len:smallint;databuff:pchar):smallint;stdcall;
far;external 'ic32.dll' name 'IC_WriteWithProtection';
function IC_ReadCount_SLE4428(icdev:longint):smallint;stdcall;
far;external 'ic32.dll' name 'IC_ReadCount_SLE4428';
function IC_CheckPass_SLE4428(icdev:longint;password:pchar):smallint;stdcall;
far;external 'ic32.dll' name 'IC_CheckPass_SLE4428';
function IC_ChangePass_SLE4428(icdev:longint;password:pchar):smallint;stdcall;
far;external 'ic32.dll' name 'IC_ChangePass_SLE4428';
{102 function}
function IC_CheckPass_102(icdev:longint;password:pchar):smallint;stdcall;
far;external 'ic32.dll' name 'IC_CheckPass_102';
function IC_ChangePass_102(icdev:longint;password:pchar):smallint;stdcall;
far;external 'ic32.dll' name 'IC_ChangePass_102';
function IC_ReadCount_102(icdev:longint):smallint;stdcall;
far;external 'ic32.dll' name 'IC_ReadCount_102';
function IC_Erase_102(icdev:longint;offset:smallint;len:smallint):smallint;stdcall;
far;external 'ic32.dll' name 'IC_Erase_102';
function IC_CheckAZPass_102(icdev:longint;zone:smallint;password:pchar):smallint;stdcall;
far;external 'ic32.dll' name 'IC_CheckAZPass_102';
function IC_ChangeAZPass_102(icdev:longint;zone:smallint;password:pchar):smallint;stdcall;
far;external 'ic32.dll' name 'IC_ChangeAZPass_102';
function IC_Fuse_102(icdev:longint):smallint;stdcall;
far;external 'ic32.dll' name 'IC_Fuse_102';
{4406 function.}
function IC_RValue(icdev:longint):smallint;stdcall;
far;external 'ic32.dll' name 'IC_RValue';
function IC_DEValue(icdev:longint):smallint;stdcall;
far;external 'ic32.dll' name 'IC_DEValue';
{1604 function.}
function IC_ChangePass_1604(icdev:longint;area:smallint;password:pchar):smallint;stdcall;
far;external 'ic32.dll' name 'IC_ChangePass_1604';
function IC_CheckPass_1604(icdev:longint;area:smallint;password:pchar):smallint;stdcall;
far;external 'ic32.dll' name 'IC_CheckPass_1604';
function IC_ReadCount_1604(icdev:longint):smallint;stdcall;
far;external 'ic32.dll' name 'IC_ReadCount_1604';
function IC_Fuse_1604(icdev:longint):smallint;stdcall;
far;external 'ic32.dll' name 'IC_Fuse_1604';
implementation{$R *.DFM}
procedure TForm1.Button1Click(Sender: TObject);
var
st: smallint;
len: smallint;
s: pchar;
stringtemp: string[128];
wdata: single;
rdata: single;
begin
{this pro must can use in you system. the 2 is the result in the screen.}
{len:=add_s(1);
str(len,s);
showmessage(s);
exit;}
{next,you should to use com1,else you must change 0 to other.}
s:=stralloc(100);
if icdev>=0 then
begin
st:=IC_Status(icdev);
if st<>0 then
begin
showmessage('system error. you must exit the program and retry again...');
exit;
end;
if st=1 then
begin
showmessage('Please insert card.');
exit;
end
else
begin
st:=IC_InitType(icdev,64);
if st=0 then
begin
stringtemp:=writedata.text;
strpcopy(s,stringtemp);
len:=strlen(s);
if len=0 then
begin
showmessage('you should write some data...');
exit;
end;
st:=IC_Write(icdev,42,len,s);
if st<0 then
begin
showmessage('write is error.');
exit;
end;
st:=IC_Read(icdev,32,len,s);
if st=0 then
begin
s[len]:=#0;
readdata2.text:=strpas(s);
end
else
showmessage('read is bad...');
st:=IC_Read(icdev,0,12,s);
if st=0 then
begin
s[12]:=#0;
readdata1.text:=strpas(s);
end
else
showmessage('read is bad...');
wdata:=1.2345678;
st:=IC_Write_Float(icdev,0,wdata);
if st<0 then
begin
showmessage('read_flaot unsuccseccful');
exit;
end;
st:=IC_Read_Float(icdev,0,addr(rdata));
if st<0 then
begin
showmessage('write_float is unsuccseccful');
exit;
end;
{FloatToStrF(rdata,ffGenera,7,1)}
stringtemp:=FloatToStr(rdata);
showmessage(stringtemp);
end
else
showmessage('initcard error.');
end;
end;
StrDispose(s);
end;procedure TForm1.Button2Click(Sender: TObject);
var
password102: pchar;
st: smallint;
begin
password102:=stralloc(4);
password102:=chr(240)+chr(240);
st:=IC_InitType(icdev,32);
if st>=0 then
begin
st:=IC_CheckPass_102(icdev,password102);
if st<0 then
showmessage('the password is not 0xf0f0.')
else
showmessage('the password ok!');
end
else
showmessage('inittype 102 is error.');
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
icdev:=IC_InitComm(0);
if icdev<0 then
begin
showmessage('error to initcomm.');
exit;
end;
end;
procedure TForm1.FormDestroy(Sender: TObject);
var
st:integer;
begin
st:=IC_ExitComm(icdev);
if st<0 then
begin
showmessage('error on exitcomm.');
exit;
end;
end;
end.
2.IC_Down() 对卡下电
3.IC_InitComm() 打开串口
4.IC_ExitComm() 关闭串口
5.IC_InitType () 设置要读卡的类型
6.IC_Read () 读IC卡的内容
7.IC_Write () 写内容到IC卡
8.IC_Erase () 对IC卡擦除操作(写FF)
9.IC_Read_Float() 读IC卡存储的浮点数
10.IC_Write_Float() 写浮点数到IC卡
11.IC_Encrypt() DES算法加密函数
12.IC_Decrypt() DES算法解密函数
13.IC_Read_Hex() 16进制读
14.IC_Write_Hex() 16进制写
15.IC_Read_Int() 读整型函数
16.IC_Write_Int() 写整型函数
你要在那里写