Private Declare Function getdata Lib "standcom.dll" _
(ByVal comlen As Long, ByRef com As Byte, ByVal leng As Long, ByRef data As Byte, ByRef device As Byte) As LongPrivate Sub Command1_Click()
Dim sendatalen As Long, gdata(20) As Byte, sdata(20) As Byte, gdata1(10) As Byte, device(11) As Byte
Dim Command(10) As Byte
Dim tempno As Long, tkh As String, txfje As Double
Dim tempcom As String, tempname As String, templeibi As String, tempstno As String
Dim intmoney As Long
tempno = Trim(Text1.Text)
tempcom = Trim(Text2.Text)
tkh = Trim(Text5.Text)
commandLen = 4
longg = 9
Command(0) = 1
Command(1) = 167
Command(2) = 9
Command(3) = 0
Command(4) = 0
device(0) = Asc("C")
device(1) = Asc("O")
device(2) = Asc("M")
device(3) = 49
ret = getdata(commandLen, Command(0), longg, gdata(0), device(0))
End Sub我写了一段delphi的,可是得到的返回值不是正确的 0,而是代表超时的 2implementation
function getdata(comlen:longint;com: array of byte;long :longint;data:array of byte;device:array of byte ) :longint ; stdcall;external 'standCOM.DLL' ;procedure TForm1.Button1Click(Sender: TObject);
var
Command:array[0..19] of byte ;
gdata :array[0..19] of byte ;
device:array[0..10] of byte ;
comlen:longint ;
lengg:longint;
ret:longint;begin comlen:=4;
lengg:=9 ;
Command[0]:=1 ;
Command[1]:=167;
Command[2]:=9 ;
Command[3]:=0;
Command[4]:=0; device[0]:=ord('C');
device[1]:=ord('O');
device[2]:=ord('M');
device[3]:=ord('1'); ret:=getdata(comlen,Command[0],lengg,gdata[0],device[0]); showmessage(inttostr(ret)) ;end;
哪位帮我看看问题出在哪了,谢谢~~
急,解决有重谢~~
(ByVal comlen As Long, ByRef com As Byte, ByVal leng As Long, ByRef data As Byte, ByRef device As Byte) As LongPrivate Sub Command1_Click()
Dim sendatalen As Long, gdata(20) As Byte, sdata(20) As Byte, gdata1(10) As Byte, device(11) As Byte
Dim Command(10) As Byte
Dim tempno As Long, tkh As String, txfje As Double
Dim tempcom As String, tempname As String, templeibi As String, tempstno As String
Dim intmoney As Long
tempno = Trim(Text1.Text)
tempcom = Trim(Text2.Text)
tkh = Trim(Text5.Text)
commandLen = 4
longg = 9
Command(0) = 1
Command(1) = 167
Command(2) = 9
Command(3) = 0
Command(4) = 0
device(0) = Asc("C")
device(1) = Asc("O")
device(2) = Asc("M")
device(3) = 49
ret = getdata(commandLen, Command(0), longg, gdata(0), device(0))
End Sub我写了一段delphi的,可是得到的返回值不是正确的 0,而是代表超时的 2implementation
function getdata(comlen:longint;com: array of byte;long :longint;data:array of byte;device:array of byte ) :longint ; stdcall;external 'standCOM.DLL' ;procedure TForm1.Button1Click(Sender: TObject);
var
Command:array[0..19] of byte ;
gdata :array[0..19] of byte ;
device:array[0..10] of byte ;
comlen:longint ;
lengg:longint;
ret:longint;begin comlen:=4;
lengg:=9 ;
Command[0]:=1 ;
Command[1]:=167;
Command[2]:=9 ;
Command[3]:=0;
Command[4]:=0; device[0]:=ord('C');
device[1]:=ord('O');
device[2]:=ord('M');
device[3]:=ord('1'); ret:=getdata(comlen,Command[0],lengg,gdata[0],device[0]); showmessage(inttostr(ret)) ;end;
哪位帮我看看问题出在哪了,谢谢~~
急,解决有重谢~~
var
Command:array[0..19] of byte ;
gdata :array[0..19] of byte;
device:array[0..10] of byte;
comlen:longint ;
lengg:longint;
ret:longint;begin
comlen:=4;
lengg:=9 ;
Command[0]:=1 ;
Command[1]:=167;
Command[2]:=9 ;
Command[3]:=0;
Command[4]:=0; device[0]:=ord('C');
device[1]:=ord('O');
device[2]:=ord('M');
device[3]:=ord('1'); ret:=getdata(comlen, @Command[0], lengg, @gdata[0], @device[0]); showmessage(inttostr(ret)) ;
end;