在delphi读取MP3文件包含的ID3-Tag头,用下面的方法很简单,作为一个菜鸟也明白。
我的问题是我把例子定义的常量_mp3file改为变量:
var
_mp3file:TStrings;
……
_mp3file:=opendialog1.Files;
……
  run的时候说[Error] Unit1.pas(56): 
There is no overloaded version of 'Create' that can be called with these arguments
有什么方法解决呢?请详细解释给我这只菜鸟好吗?例子:
type 
TID3Tag = packed record // 128 字节
   TAGID: array[0..2] of char; // 3 字节: 必须是TAG
   Title: array[0..29] of char; // 30 字节: 歌曲标题
   Artist: array[0..29] of char; // 30 字节: 歌曲的艺术家
   Album: array[0..29] of char; // 30 字节: 歌曲专辑
   Year: array[0..3] of char; // 4 字节: 出版年
   Comment: array[0..29] of char; // 30 字节: 评论
   Genre: byte; // 1 字节: 种类标识
end; procedure TForm1.Button1Click(Sender: TObject); 
const  //我的问题
  _mp3file='G:\Mp3\Miscellaneous\ATC - Around The World.mp3'; 
var
  id3tag: Tid3tag;
  mp3file: Tfilestream; 
begin
  mp3file:=Tfilestream.create(_mp3file,fmOpenRead);//run的时候会出错
  try
    mp3file.position:=mp3file.size-128; // 跳到id3-tag
    mp3file.Read(id3tag,SizeOf(id3tag));
    showmessage(' Title: '+id3tag.title+#13+
                ' Artist: '+id3tag.artist+#13+
                ' Album: '+id3tag.album+#13+
                ' Year: '+id3tag.year+#13+
                ' Comment: '+id3tag.comment+#13+
                ' Genre-ID: '+inttostr(id3tag.genre)
                );
  finally
    mp3file.free;
  end; 
end;

解决方案 »

  1.   

    把_mp3File定义成string,并且修改
    _mp3file:=opendialog.files-->
    _mp3file:=opendialog.filename如果你想处理多个文件,请用循环来做即可:
    for i:=0 to OpenDialog1.Files.count -1 do
    begin
      _mp3file:=Opendialog1.files[i];
       mp3file:=TFileStream.Create(_mp3file,.....);
      ......
    end;你的基础太差,多看书吧。
      

  2.   

    谢谢Kingron ,我的其实菜鸟,我会多家修炼的。可否在回答我两个菜的问题:
    1.解释一下这句错误信息:There is no overloaded version of 'Create' that can be called with these arguments
    2.TStrings和String有什么区别,我想这样却不可以:请问怎么解决?
    memo1.Lines:=(' Title: '+id3tag.title+#13+
                    ' Artist: '+id3tag.artist+#13+
                    ' Album: '+id3tag.album+#13+
                    ' Year: '+id3tag.year+#13+
                    ' Comment: '+id3tag.comment+#13+
                    ' Genre-ID: '+inttostr(id3tag.genre)
                    );
      

  3.   

    1:没有重载的Create可以使用这些参数来调用
    就是说,你的函数的参数和声明的不匹配!可能原因:就是你声明了一个A类型的变量,而参数应该是B类型的。2:TString是一个虚基类,是一个对象,string是一个基本数据类型,可以这么说TStrings是用来管理若干个string列表的。