下面PB语调用如果在delphi中实现(50分)

W

wh88

Unregistered / Unconfirmed
GUEST, unregistred user!
现有Whsbick.dll文件
用PB定义的Wh_ick_read 函数
[功能定义]
Whsbick WINAPI Wh_ick_read (out char grbh,out char gmsfhm, out char error_infor,out char psamkh,out char icknm,out char(yyyymmdd) yxsj)
[功能描述]
用于读取IC卡编号,读取失败时,返回对应的错误信息。整个调用过程只需调用该函数一次即可。
[参数说明]
grbh: 读卡,返回IC卡编号。
gmsfhm: 读卡,返回公民身份证号。
error_infor : 失败时返回错误中文信息。
psamkh:返回读卡设备的psam编号。
icknm:返回IC卡内部编号(卡序列号)。
yxsj:返回IC卡使用的有效时间,日期格式为yyyymmdd。
[返回值]
Wh_ick_read 0表示成功;返回其它值表示失败。

现在想请大家帮我写一个delphi调用实例.
 
试写一下:
function Wh_ick_read(var grbh,gmsfhm,error_infor,psamkh ,icknm , yxsj : pchar) : integer;
stdcall;external 'Whsbick.dll' name 'Wh_ick_read ';
其中的Var关键字也可以用out替换
 
能不能帮我写一个实例呢,如调用Wh_ick_read读取数据,并返回给变量,如果读取失败则返回错误信息.
 
假设函数声明为:
function Wh_ick_read(var grbh,gmsfhm,error_infor,psamkh ,icknm , yxsj : pchar) : integer;
stdcall;external 'Whsbick.dll' name 'Wh_ick_read ';
则先声明变量:
var grbh,gmsfhm,error_infor,psamkh ,icknm , yxsj : pchar;
然后调用:
if Wh_ick_read(grbh,gmsfhm,error_infor,psamkh ,icknm , yxsj) <> 0 then
showmessage(strpas(error_infor))
else
begin
showmessage(strpas(grbh) + #13#10 +
strpas(gmsfhm) + #13#10 +
strpas(psamkh) + #13#10 +
strpas(icknm) + #13#10 +
strpas(yxsj) + #13#10
);
end;
 

Similar threads

D
回复
0
查看
1K
DelphiTeacher的专栏
D
S
回复
0
查看
3K
SUNSTONE的Delphi笔记
S
S
回复
0
查看
2K
SUNSTONE的Delphi笔记
S
I
回复
0
查看
580
import
I
I
回复
0
查看
811
import
I
顶部