H
hncsym
Unregistered / Unconfirmed
GUEST, unregistred user!
问题是这样的,要跟酒管软件做一个门锁接口,酒管软件是用DELPHI开发,可是提供的接口示例里面只有VB和PB的,没有DELPHI语言的接口,根据说明把接口转换成DELPHI语言的调用,但程序执行后一直报错。DELPHI调用接口声明如下: function opencomm(com:integer):integer; stdcall;external 'larkdll.dll'; function closecomm():integer; stdcall;external 'larkdll.dll'; function deletecard(a7char):integer;external 'larkdll.dll'; function makecard(a1,a2,a3,a4,a5,a6,a7char):integer; external 'larkdll.dll'; function readcard(bufferchar;a7char):integer; external 'larkdll.dll';VB中声明如下:Declare Function opencomm Lib "larkdll.dll" (ByVal port%) As Integer '串口选择Declare Function closecomm Lib "larkdll.dll" () As Integer '关闭串口Declare Function deletecard Lib "larkdll.dll" (ByVal buffer$) As Integer '退卡Declare Function makecard Lib "larkdll.dll" (ByVal buffer1$, ByVal buffer2$, ByVal buffer3$, ByVal buffer4$, ByVal buffer5$, ByVal buffer6$, ByVal buffer7$) As Integer '写卡Declare Function readcard Lib "larkdll.dll" (ByVal buffer1$, ByVal buffer2$) As Integer '读卡我们现在把问题简化下,在DELPHI语言下只测试打开串口和关闭串口以及退客人卡这三个调用,其中打开串口和关闭串口正常,但是退客人卡调用一直报错,调用接口如下:procedure TForm1.Button4Click(Sender: TObject);var ret:integer;begin ret:=deletecard(pchar(trim(Edit1.Text)));//传入的是接口注册码 if ret<>0 then begin application.MessageBox(pchar('销卡失败!'),pchar(application.Title),0); end else begin application.MessageBox(pchar('销卡成功!'),Pchar(application.Title),0); end;end;哪位能够提供点建议,万分感谢!