Private Declare Function File_Count Lib "p2kapi.DLL" () As Integer
Private Declare Function File_List Lib "p2kapi.DLL" (ByVal Buffer() As Byte, ByVal Count As Integer) As Integer
Public Function GetFileList() As String Info.FileCount = Me.File_Count() If Info.FileCount > -1 Then
Dim rtn As Integer
Dim d(Info.FileCount * 512 - 1) As Byte
Dim fileb(503) As Byte
Dim i As Integer, s As String
Dim j As Integer
ReDim Info.Files(Info.FileCount - 1) rtn = (Me.File_List(d, File_Count())) If rtn > -1 Then
For i = 0 To Info.FileCount - 1 Info.Files(i).Att1 = Hex(d(i * 512 + 5)) & Hex(d(i * 512 + 6)) & Hex(d(i * 512 + 7))
'8-511位为文件名
For j = 0 To 503
fileb(j) = d(i * 512 + 8 + j)
Next
Info.Files(i).FileName = System.Text.Encoding.ASCII.GetString(fileb)
Next
End If
Else
Return -1
End If
Private Declare Function File_List Lib "p2kapi.DLL" (ByVal Buffer() As Byte, ByVal Count As Integer) As Integer
Public Function GetFileList() As String Info.FileCount = Me.File_Count() If Info.FileCount > -1 Then
Dim rtn As Integer
Dim d(Info.FileCount * 512 - 1) As Byte
Dim fileb(503) As Byte
Dim i As Integer, s As String
Dim j As Integer
ReDim Info.Files(Info.FileCount - 1) rtn = (Me.File_List(d, File_Count())) If rtn > -1 Then
For i = 0 To Info.FileCount - 1 Info.Files(i).Att1 = Hex(d(i * 512 + 5)) & Hex(d(i * 512 + 6)) & Hex(d(i * 512 + 7))
'8-511位为文件名
For j = 0 To 503
fileb(j) = d(i * 512 + 8 + j)
Next
Info.Files(i).FileName = System.Text.Encoding.ASCII.GetString(fileb)
Next
End If
Else
Return -1
End If
解决方案 »
- Operation not applicable.Delphi2010.三层系统,某些电脑上出现?缺少文件?
- 画图信息的几个疑问!
- 初学delphi,一个小问题,请兄弟们帮忙!
- 关于indy连接ftp的问题
- 跟潮流,散200祝大家新年愉快!狗年行狗运!
- 请问一个表放60个字段多吗?
- 在ReportBuilder上放什么控件可以画线呀,急!
- 我用QUERY1查询结果放到DBGRID中然后我修改记录,怎样反映到DGGRID中不用
- 请问BDE是什么?现在Delphi数据库开发用BDE的多还是ADO的多?我可以不学BDE吗?
- 说你胖,你就喘,给你点分你就抢
- 如何在线程类里面定义VCL类(如TEdit)
- 各位大哥,谁有烟草生产企业的结构图?
Function File_Count():Integer;external 'p2kapi.DLL';
Function File_List(Buffer: char; Count: Integer):Integer;external 'p2kapi.DLL';
public
Function GetFileList():String;function TForm1.File_Count: Integer;
var
rtn,i,j: Integer;
d,d1,d2,d3,fileb: integer;
s: string;
begin
//info 我想应该是控件的name吧
Info.FileCount := self.File_Count();
d := Info.FileCount * 512 - 1;
fileb := 503;
//这里不知如何搞?
// Info.Files(Info.FileCount - 1);
rtn := (self.File_List(d, File_Count()));
If rtn > -1 Then
begin
For i := 0 To Info.FileCount - 1 do
begin
d1 := i * 512 + 5;
d2 := i * 512 + 7;
d3 := i * 512 + 8 + j;
//这里不知如何搞?
//Info.Files(i).Att1 = Hex(d(i * 512 + 5)) & Hex(d(i * 512 + 6)) & Hex(d(i * 512 + 7)) Info.Files(i).Att1 := Hex(d1) & Hex(d2) & Hex(d3;) //8-511位为文件名
For j := 0 To 503 do
begin
d := i * 512 + 8 + j;
fileb(j) := d;
end;
//这里不知如何搞?
//Info.Files(i).FileName := System.Text.Encoding.ASCII.GetString(fileb);
end;
end;
end;
'8-511位为文件名
For j = 0 To 503
fileb(j) = d(i * 512 + 8 + j)
Next
Info.Files(i).FileName = System.Text.Encoding.ASCII.GetString(fileb)应该为
Hex 表示为IntToHex(....)
d应该为一个函数
fileName 是AnsiPchar