【发布时间】:2018-11-16 02:52:57
【问题描述】:
开发环境为Delphi xe2,Windows 10 64位。 我要复制一个假脱机文件。 我将驱动程序虚拟安装在 LPT1 端口上。驱动程序处于暂停状态。 您即将从文件夹 C:\Windows\System32\spool\PRINTERS 导入 .spl 文件和 .shd 文件。 但是,无法调用该文件夹中的文件列表。 如何将列表导入该文件夹?
function FindFiles(const sPath, sMask: string; slFiles: TStringList; bSubDir: boolean): integer;
var
iFindResult: integer;
srSchRec : TSearchRec;
begin
result := 0;
iFindResult := FindFirst(sPath + sMask, faAnyFile - faDirectory, srSchRec);
while iFindResult = 0 do
begin
slFiles.Add(sPath + srSchRec.Name);
iFindResult := FindNext(srSchRec);
end;
FindClose(srSchRec);
if bSubDir then
begin
iFindResult := FindFirst(sPath + '*.*', faDirectory, srSchRec);
while iFindResult = 0 do
begin
if (srSchRec.Name <> '.') and (srSchRec.Name <> '..') then
result := result + FindFiles(sPath + srSchRec.Name + '\', sMask, slFiles, TRUE);
iFindResult := FindNext(srSchRec);
end;
FindClose(srSchRec);
end;
end;
【问题讨论】:
标签: delphi