VB几行代码转化成delphi,100分 ( 积分: 100 )

  • 主题发起人 主题发起人 ybb507
  • 开始时间 开始时间
Y

ybb507

Unregistered / Unconfirmed
GUEST, unregistred user!
Private Declare Function ReadTime Lib "yktcomm" (ByVal CommNo As Byte, ByVal MachNo As Integer, Data As Byte) As Byte
Private Declare Function LoadTime Lib "yktcomm" (ByVal CommNo As Byte, ByVal MachNo As Integer, Data As Byte) As Byte
Private Declare Sub OpenEtc Lib "yktcomm" (ByVal CommNo As Byte, ByVal MachNo As Integer, ByVal Para1 As Byte, ByVal Para2 As Byte)
Private Declare Function ReadID Lib "yktcomm" (ByVal CommNo As Byte, ByVal MachNo As Integer, Data As Byte) As Byte
Private Declare Function ReadParkRec Lib "yktcomm" (ByVal CommNo As Byte, ByVal MachNo As Integer, Data As Byte) As Byte
Private Declare Function ReadRecCount Lib "yktcomm" (ByVal CommNo As Byte, ByVal MachNo As Integer, Data As Byte) As Byte
Private Declare Function SelectMode Lib "yktcomm" (ByVal CommNo As Byte, ByVal MachNo As Integer, ByVal Mode As Byte) As Byte
Private Declare Sub SecDelay Lib "yktcomm" (ByVal lngDelayTime As Long)
 
function ReadTime(CommNo:Byte;MachNo:Integer;Data:Byte):integer;stdcall;external 'yktcomm.dll';
其他类似
 
function ReadTime(CommNo:char;MachNo:integer;Data:string):smallint;stdcall;external 'yktcomm.dll';行不?
 
不清楚,好久没有使用VB,也没有安装VB,所以只好请你自己测试了,我的感觉是只要多想几种方法,总能够解决问题
 
procedure TForm.ButtonClick(Sender: TObject);
Var
Stmp : String;
bRet : Byte;
i : int;
begin
stmp := '';
bRet := ReadID(intComNo, intMachNo, Data(0));
For i := 0 To 7 do
stmp := stmp + copy(('00'+ Chr(Ord(Data(i)))),0,2);
label1.Caption := 'H' + Copy(stmp,0,6);
end;

可以试试
 
procedure TfrmCMain.BitBtn1Click(Sender: TObject);
var stmp :string;
Data:array [0..1100] of byte ;
i:integer;
st:byte;
begin
stmp :='';
st:= ReadID(0,1,Data[0]);
begin
for i:=0 to 7 do
stmp :=stmp + RightStr('00'+ Chr(Ord(Data)),2) ;
end;

end;________________________还不行呢, 各位帮忙
 
建议楼主不要更换问题内容,这样会让后来的人不知所云
 
function ReadID(CommNo: Byte; MachNo: Integer; Data: Byte): Byte; external 'yktcomm';


var
stmp: string;
bRet: Byte;
i: Integer;
begin
stmp := '';
bRet := ReadID(intComNo, intMachNo, Data[0])
for i := 0 to 7 do
begin
stmp := stmp + RightStr('00' + IntToHex(Data), 2);
end;
stmp := 'H' + RightStr(stmp, 6);
Text1(4).Text := stmp;
end;

;引用StrUtils
 
还没解决,晕死
var
stmp: string;
bRet: Byte;
i: Integer;
begin
stmp := '';
bRet := ReadID(intComNo, intMachNo, Data[0])
for i := 5 to 7 do
begin
stmp := stmp + IntToHex(Data, 2);
end;
stmp := strtoint('$' + stmp);
end;
 
赶紧来送分.
 
ReadID

这个是什么? VB里有这个吗?
 
多人接受答案了。
 
后退
顶部