
16.12.2009, 19:20
|
Прохожий
|
|
Регистрация: 16.12.2009
Сообщения: 1
Репутация: 10
|
|
Поиск в папке и подпапках (что то странное творится)
Вот скелет. В одном проекте он работает, а при копировании содержимого в другой - тупо вылетает форма с пустым МЕМО. В чем может быть причина?
P.S. делфи 7
Код:
unit del;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, masks, ExtCtrls,ComObj, ShlObj;
type
TForm1 = class(TForm)
memo1: TMemo;
procedure FormCreate(Sender: TObject);
private
public
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure FindFiles(StartFolder, Mask: string; List: TStrings;
ScanSubFolders: Boolean = True);
var
SearchRec: TSearchRec;
FindResult: Integer;
begin
List.BeginUpdate;
try
StartFolder := IncludeTrailingPathDelimiter(StartFolder);
FindResult := FindFirst(StartFolder + '*.*', faAnyFile, SearchRec);
try
while FindResult = 0 do
with SearchRec do
begin
if (Attr and faDirectory) <> 0 then
begin
if ScanSubFolders and (Name <> '.') and (Name <> '..') then
FindFiles(StartFolder + Name, Mask, List, ScanSubFolders);
end
else
begin
if MatchesMask(Name, Mask) then
List.Add(StartFolder + Name);
end;
FindResult := FindNext(SearchRec);
end;
finally
FindClose(SearchRec);
end;
finally
List.EndUpdate;
end;
end;
procedure TForm1.FormCreate(Sender: TObject);
var f:file of byte;
g, l, r: integer;
s, oldName, newName, blob : string;
begin
FindFiles('C:\1\', 'pro?.*', memo1.lines, true);
for r := 0 to Memo1.Lines.Count-1 do
begin
.................
МОЙ КОД
.................
end;
end;
end.
|