📄 delphi95.txt
字号:
Delphi 3.0 在Windows95下读写器接口函数使用方法:
函数声明:
implementation
function Init_com(Port:integer):integer; stdcall; external 'sure32wc' index 1;
Function sele_card(crdno:integer):integer; stdcall; external 'sure32wc' index 4;
Function power_on:integer; stdcall; external 'sure32wc' index 2;
Function power_off:integer; stdcall; external 'sure32wc' index 3;
Function close_com:integer; stdcall; external 'sure32wc.dll' index 27;
Function rd_asc(apz, address, Length:integer; buffer:pchar):integer; stdcall; external 'sure32wc' index 22;
Function wr_asc(apz, address, Length:integer; buffer:pchar):integer; stdcall; external 'sure32wc' index 24;
Function rd_str(apz, address, Length:integer; buffer:pchar):integer; stdcall; external 'sure32wc' index 9;
Function wr_str(apz, address, Length:integer; buffer:pchar):integer; stdcall; external 'sure32wc' index 11;
Function chk_sc(i1, i2:Integer; Str:pchar):integer; stdcall; external 'sure32wc' index 5;
Function wr_sc(Str:pchar):integer; stdcall; external 'sure32wc' index 16;
.
.
.
注:动态连接库中函数索引列表保存在\SUREDVRW\WIN95API\SURE32WC.DEF中。
变量定义:
读写器接口函数所使用的字符串变量,应事先分配足够的内存空间,再将字符串指针作为参数传递.
应用举例:
Var
Buf1 : Array [0..300] of Char; 150个HEX数据缓冲区
Buf2 : Array [0..150] of Char; 150个字符串缓冲区
Hp,Sp : Pchar;
A,B,C,D,E,F,G,H : Integer;
Begin
A := Init_Com(1); 初始化串口2
B := Sele_Card(42); 选择Siemens 4442卡,卡型编号42
C := Power_on; 卡上电操作
Sp := 'FFFFFF'; Siemens 4442空白卡缺省密码
D := Chk_SC(0,3,Sp); 核对密码
if D<>0 then 密码错误则退出
Begin
MessageBox(0,'密码错误','演示',mb_ok);
exit;
end;
Hp := @Buf1;
E := Rd_Asc(1,0,150,Hp); 读取150个字节HEX数据,返回300个字符
Hp := @Buf2;
F := Rd_Str(1,0,150,Hp); 读取150个字节字符串,返回150个字符
G := Power_off; 卡下电操作
H := Close_com; 关闭串口
end;
注意:
串口初始化操作仅需在系统启动时进行一次,系统退出时关闭串口。
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -