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
解决方案 »
- 数据库数据由用户写入,每分钟写入一次,我要在写入后读新数据,计算,放入我自己的数据库表中
- 我在操作数据库时,突然数据库停止,系统可以提示我通知我连接失败,但我该如何退出程序,而不报“应用程序错误内存读写”的windows对话框呢?
- 关于delphi用消息机制在两个应用程序间传递变量的问题
- 一个关于数据显示和删除的问题,请各位大侠照顾一下第一次发贴的新手好吗?^_^
- 判读字符串是数字,急,菜鸟求助
- 在安装完Oracle后如何配置Configuration Assistant?
- 各位大虾,Linux能不能组建无盘工作站,有谁能提供一点资料?
- 在QuickRep里打印较多的字符时(TDBText),如何让它自动换行(特别是Memo类型的字段值)
- 一个怪现象,给分24
- 有关activeform的问题,怎么不能使用数据模块?
- 如何在线程类里面定义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