1,485
社区成员
发帖
与我相关
我的任务
分享
在演示程序中把dll文件声明于implementation中下面
function Rcard(rdata:pchar;track:integer):integer;stdcall;external'JINCARD7.dll';
function Wcard(wdata:pchar;track:integer):integer;stdcall;external'JINCARD7.dll';
//主程序 :
if 1 = Init_com('1,9600,n,8,1') then //初始化端口成功
begin
if 1 = Rcard(rdata,5) then //调用库中的读函数,读二,三磁道,若成功则
begin
i:=pos ('a',rdata);
strlcopy(str2,rdata,i-1); //拷贝磁道二中的内容于str2中
strcopy(str3,rdata+i); //拷贝磁道三中的内容于str3中
ShowMessage('读卡成功!'); //显示读卡成功对话框
end;
wdata:= '2222222222a333333333';
if 1 = Wcard(wdata,5) then //调用库中的写函数进行写二,三磁道,若成功则
begin
ShowMessage('写卡成功!'); //显示写卡成功对话框
end;
end;
Public Declare Function Rcard Lib "JINCARD7.DLL" (ByVal radata As String, ByVal track As Integer) As Integer
Public Declare Function Wcard Lib "JINCARD7.DLL" (ByVal radata As String, ByVal track As Integer) As Integer
Public Declare Function Init_com Lib "CARD.DLL" (ByVal sett As String) As Integer
If 1 = Init_com("1,9600,n,8,1") Then
MsgBox "test"
End If