我在from2中用了TDriveComboBox和TDirectoryListBox这两个控件,然后再到from1中创建文件就不能了!写也不能!from1和from2的关系是1调用2,如果我执行程序时不调用from2的话就可以创建文件或写文件!请大家帮帮忙!急急急呀!from2中遍历目录的代码是这样的!//我做的是个播放器,
procedure TForm2.ButtonXPMACCorel1Click(Sender: TObject);
var
i:integer;
searchRec:TsearchRec;
seat:string;
begin ///dlb为 TDirectoryListBox类
filepa:=dlb.GetItemPath(dlb.ItemIndex);///得到选择目录的路径
filepa:=filepa+'\';
//showmessage(filepa);
for i:=0 to 3 do
begin
if i=0 then seat:='*.mp3';
if i=1 then seat:='*.wav';
if i=2 then seat:='*.mpeg';
if i=3 then seat:='*.mid';
if (FindFirst(filepa+seat, faAnyFile-faDirectory, SearchRec)=0) then
begin
Form1.ListBox2.Items.Add(filepa+searchrec.Name);
if i<>3 then
///添加到from1中的listbox中去,GetNameFromTag()为读文件信息的函数
Form1.ListBox1.Items.Add(GetNameFromTag(filepa+searchrec.Name))
////namer()也是读文件信息的函数
else Form1.ListBox1.Items.Add(namer(filepa+searchrec.Name));
while (FindNext(SearchRec) = 0) do
begin
Form1.ListBox2.Items.Add(filepa+searchrec.Name);
if i<>3 then
Form1.ListBox1.Items.Add(GetNameFromTag(filepa+searchrec.Name))
else Form1.ListBox1.Items.Add(namer(filepa+searchrec.Name));
end;
end;
FindClose(SearchRec);
Dcb.Free;
Dlb.Free;
end;
close;
end;请问是这里什么没有释放的吗?我真的找不出哪里出问题了!给位老大帮忙啊!
procedure TForm2.ButtonXPMACCorel1Click(Sender: TObject);
var
i:integer;
searchRec:TsearchRec;
seat:string;
begin ///dlb为 TDirectoryListBox类
filepa:=dlb.GetItemPath(dlb.ItemIndex);///得到选择目录的路径
filepa:=filepa+'\';
//showmessage(filepa);
for i:=0 to 3 do
begin
if i=0 then seat:='*.mp3';
if i=1 then seat:='*.wav';
if i=2 then seat:='*.mpeg';
if i=3 then seat:='*.mid';
if (FindFirst(filepa+seat, faAnyFile-faDirectory, SearchRec)=0) then
begin
Form1.ListBox2.Items.Add(filepa+searchrec.Name);
if i<>3 then
///添加到from1中的listbox中去,GetNameFromTag()为读文件信息的函数
Form1.ListBox1.Items.Add(GetNameFromTag(filepa+searchrec.Name))
////namer()也是读文件信息的函数
else Form1.ListBox1.Items.Add(namer(filepa+searchrec.Name));
while (FindNext(SearchRec) = 0) do
begin
Form1.ListBox2.Items.Add(filepa+searchrec.Name);
if i<>3 then
Form1.ListBox1.Items.Add(GetNameFromTag(filepa+searchrec.Name))
else Form1.ListBox1.Items.Add(namer(filepa+searchrec.Name));
end;
end;
FindClose(SearchRec);
Dcb.Free;
Dlb.Free;
end;
close;
end;请问是这里什么没有释放的吗?我真的找不出哪里出问题了!给位老大帮忙啊!
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货