Q&A

  • 소스 좀 봐 주세요
procedure TForm1.ibt2Click(Sender: TObject);

var

i,h,count,cnt:integer;

mp3list:TInifile;

name:string;

mp3memo:Tstringlist;

begin

play_style := true;

lbmp3.Visible := true;

lb.Visible := false;

mp3list:=Tinifile.Create(dir+'mp3list.ini');

cnt := mp3list.ReadInteger('mp3list','count',0);

for h:=0 to cnt-1 do

begin

mp3list.DeleteKey('mp3list',inttostr(h)+'_name');

mp3list.DeleteKey('mp3list',inttostr(h)+'_path');

end;

deletefile(dir+'mp3.m3u');

mp3memo := Tstringlist.Create;

if od.Execute then

begin

mp3memo.Clear;

lbmp3.Clear;

count := od.Files.Count;

mp3list.WriteInteger('mp3list','count',count);

for i:=0 to count-1 do

begin

name := ExtractFileName(od.Files[i]);

mp3list.WriteString('mp3list',inttostr(i)+'_name',name);

mp3list.WriteString('mp3list',inttostr(i)+'_path',od.Files.Strings[i]);

lbmp3.items.add(mp3list.ReadString('mp3list',inttostr(i)+'_name',''));

mp3memo.Append(od.Files.Strings[i]);

end;

mp3list.free;

if od.FilterIndex = 1 then

begin

mp3memo.SaveToFile(dir+'mp3.m3u');

@mp3memo.Free;

amp.Visible := true;

amp.FileName := dir+'mp3.m3u';

end

else

begin

mp3memo.Free;

mp3list:=Tinifile.Create(dir+'mp3list.ini');

amp.Visible := true;

amp.FileName := mp3list.ReadString('mp3list','0_path','');

mp3list.Free;

end;

end;

end;



처음 오픈다이얼로그에는 에러가 안 나는데 2번째 오픈다이얼로그를 열면 @에 있는 부분에서 에러가 납니다.



한번 봐 주세요





2  COMMENTS
  • Profile
    그냥 2000.10.26 21:42
    에러가 나는 부분을 요렇게 바꾸면 잘 돌아가지 않나요?

    예전에 비슷한 경험을 한거 같아서리...

    if od.FilterIndex = 1 then

    begin

    try

    mp3memo.SaveToFile(dir+'mp3.m3u');

    finally

    @mp3memo.Free;

    end;

    에구..머리가 나빠서 맞는지 모르겠네요..

    참조해 보세요...쩝..





    조헌철 wrote:

    > procedure TForm1.ibt2Click(Sender: TObject);

    > var

    > i,h,count,cnt:integer;

    > mp3list:TInifile;

    > name:string;

    > mp3memo:Tstringlist;

    > begin

    > play_style := true;

    > lbmp3.Visible := true;

    > lb.Visible := false;

    > mp3list:=Tinifile.Create(dir+'mp3list.ini');

    > cnt := mp3list.ReadInteger('mp3list','count',0);

    > for h:=0 to cnt-1 do

    > begin

    > mp3list.DeleteKey('mp3list',inttostr(h)+'_name');

    > mp3list.DeleteKey('mp3list',inttostr(h)+'_path');

    > end;

    > deletefile(dir+'mp3.m3u');

    > mp3memo := Tstringlist.Create;

    > if od.Execute then

    > begin

    > mp3memo.Clear;

    > lbmp3.Clear;

    > count := od.Files.Count;

    > mp3list.WriteInteger('mp3list','count',count);

    > for i:=0 to count-1 do

    > begin

    > name := ExtractFileName(od.Files[i]);

    > mp3list.WriteString('mp3list',inttostr(i)+'_name',name);

    > mp3list.WriteString('mp3list',inttostr(i)+'_path',od.Files.Strings[i]);

    > lbmp3.items.add(mp3list.ReadString('mp3list',inttostr(i)+'_name',''));

    > mp3memo.Append(od.Files.Strings[i]);

    > end;

    > mp3list.free;

    > if od.FilterIndex = 1 then

    > begin

    > mp3memo.SaveToFile(dir+'mp3.m3u');

    > @mp3memo.Free;

    > amp.Visible := true;

    > amp.FileName := dir+'mp3.m3u';

    > end

    > else

    > begin

    > mp3memo.Free;

    > mp3list:=Tinifile.Create(dir+'mp3list.ini');

    > amp.Visible := true;

    > amp.FileName := mp3list.ReadString('mp3list','0_path','');

    > mp3list.Free;

    > end;

    > end;

    > end;

    >

    > 처음 오픈다이얼로그에는 에러가 안 나는데 2번째 오픈다이얼로그를 열면 @에 있는 부분에서 에러가 납니다.

    >

    > 한번 봐 주세요

    >

    >

  • Profile
    조헌철 2000.10.26 22:01
    그냥 wrote:

    > 에러가 나는 부분을 요렇게 바꾸면 잘 돌아가지 않나요?

    > 예전에 비슷한 경험을 한거 같아서리...

    > if od.FilterIndex = 1 then

    > begin

    > try

    > mp3memo.SaveToFile(dir+'mp3.m3u');

    > finally

    > @mp3memo.Free;

    > end;

    > 에구..머리가 나빠서 맞는지 모르겠네요..

    > 참조해 보세요...쩝..

    >

    >

    > 조헌철 wrote:

    > > procedure TForm1.ibt2Click(Sender: TObject);

    > > var

    > > i,h,count,cnt:integer;

    > > mp3list:TInifile;

    > > name:string;

    > > mp3memo:Tstringlist;

    > > begin

    > > play_style := true;

    > > lbmp3.Visible := true;

    > > lb.Visible := false;

    > > mp3list:=Tinifile.Create(dir+'mp3list.ini');

    > > cnt := mp3list.ReadInteger('mp3list','count',0);

    > > for h:=0 to cnt-1 do

    > > begin

    > > mp3list.DeleteKey('mp3list',inttostr(h)+'_name');

    > > mp3list.DeleteKey('mp3list',inttostr(h)+'_path');

    > > end;

    > > deletefile(dir+'mp3.m3u');

    > > mp3memo := Tstringlist.Create;

    > > if od.Execute then

    > > begin

    > > mp3memo.Clear;

    > > lbmp3.Clear;

    > > count := od.Files.Count;

    > > mp3list.WriteInteger('mp3list','count',count);

    > > for i:=0 to count-1 do

    > > begin

    > > name := ExtractFileName(od.Files[i]);

    > > mp3list.WriteString('mp3list',inttostr(i)+'_name',name);

    > > mp3list.WriteString('mp3list',inttostr(i)+'_path',od.Files.Strings[i]);

    > > lbmp3.items.add(mp3list.ReadString('mp3list',inttostr(i)+'_name',''));

    > > mp3memo.Append(od.Files.Strings[i]);

    > > end;

    > > mp3list.free;

    > > if od.FilterIndex = 1 then

    > > begin

    > > mp3memo.SaveToFile(dir+'mp3.m3u');

    > > @mp3memo.Free;

    > > amp.Visible := true;

    > > amp.FileName := dir+'mp3.m3u';

    > > end

    > > else

    > > begin

    > > mp3memo.Free;

    > > mp3list:=Tinifile.Create(dir+'mp3list.ini');

    > > amp.Visible := true;

    > > amp.FileName := mp3list.ReadString('mp3list','0_path','');

    > > mp3list.Free;

    > > end;

    > > end;

    > > end;

    > >

    > > 처음 오픈다이얼로그에는 에러가 안 나는데 2번째 오픈다이얼로그를 열면 @에 있는 부분에서 에러가 납니다.

    > >

    > > 한번 봐 주세요

    > >

    > >