[求助]关于接口的衔接问题!
下面是读卡器提供的delphi接口,怎么编写一个按钮后面的代码跟这个接口衔接?-----------------------------------------------------------------
type TOMR=function(Cmd:Pchar):Integer;stdcal;
var
hinst:thandle;
fpointer:tfarproc;
OmrG,OmrS,TmOmrGetStatu,TmOmrGetValue:TOMR;
Cmd:array[0..39] of char;
Buf:array[0..255] of char;
begin
hinst:=loadlibrary('OMRCLIEN.DLL');
if hinst>0 then
try
fpointer:=getprocaddress(hinst,'OmrS');
OmrS:=TOMR(fpointer);
fpointer:=getprocaddress(hinst,'OmrG');
OmrG:=TOMR(fpointer);
fpointer:=getprocaddress(hinst,'TmOmrGetStatu');
TmOmrGetStatu:=TOMR(fpointer);
fpointer:=getprocaddress(hinst,'TmOmrGetStatu');
TmOmrGetStatu:=TOMR(fpointer);
OmrG:='S 100.fom/';
OmrS(Cmd); //送格式命令
Cmd:='/';
OmrS(Cmd); //送读卡命令
OmrG(Buf); //取读卡返回字串
if copy(Buf,1,2)='OK' then
begin
Cmd:='001 /';
OmrS(Cmd); //送取数据命令
OmrG(Buf); //取返回字串
TmOmrGetStatu(Buf);
If copy(Buf,1,2)= 'OK' then
TmOmrGetValue(Buf);
end
finally
freelibrary(hinst);
end
else
showmessage('Dll function not found');
end;
---------------------------------------------------------------------------------