delphi 的函数VB里怎写,大家来帮忙一下
DELPHI读写一个DLL如下function Read_CardID(aData :Pchar): Integer;
stdcall; external 'TemicUsbDll.dll' name 'Read_CardID';
procedure TForm8.BitBtn1Click(Sender: TObject);
var
CardID :array[0..3] of char;
str :String;
i,iresult:Integer;
begin
if( Read_CardID(CardID) <> 0 ) then
begin
SPK_Beep(2); //响声函数
exit;
end;
SPK_Beep(1);
str :='';
for i:=0 to 3 do
str :=str+ inttohex(ord(CardID[i]),2);
insert('',str,3);
insert('',str,6);
insert('',str,9);
MaskEdit1.Text :=str;
end;
如果用VB6怎写呢?下面这样正正确吗?
'读卡号
Public Declare Function Read_CardID Lib "TemicUsbDll.dll" (ByVal CardID As String) As Integer
调用时这样
Dim CardID As String * 30
iResult = Read_CardID(CardID)
If iResult <> 0 Then
MsgBox ("读不到" & iResult)
Else
MsgBox Hex(Asc(CardID))
End If
如果是这样写 只能读到一部分,Pchar在delphi中是数组类型的, 如果VB里用数组读。 怎定义呢? 请大家帮忙