高手们帮忙啊!
在点击打开按钮以后,可以一次选择多个文件,但是并不打开他们,只是将他们的属性(文件名,路径,大小,修改时间……)显示在我窗体里的ListView里面?怎么搞啊?分不够还可以加啊!急啊!

解决方案 »

  1.   

    用TSearchRec。
    Demo:
    var
      Rec :TSearchRec;
    begin
      if (OpenDialog1.Execute) and (OpenDialog1.FileName<>'') then
      begin
        Rec.Name := OpenDialog1.FileName;
        ListBox1.Items.Add('文件名:'+Rec.Name);
        ListBox1.Items.Add('大小:'+IntToStr(Rec.Size));
        ListBox1.Items.Add('属性:'+IntToStr(Rec.Attr));
        ListBox1.Items.Add('创建时间:'+IntToStr(Rec.Time));
      end;
    end;
      

  2.   

    OPenDialog1.Options :=[ofHideReadOnly,ofAllowMultiSelect,ofEnableSizing];
      OPenDialog1.Execute;
      ShowMessage(OPenDialog1.Files.Text);
      

  3.   

    写错了 -_-#
    var
      Rec :TSearchRec;
    begin
      if (OpenDialog1.Execute) and (OpenDialog1.FileName<>'') then
      begin
        FindFirst(OpenDialog1.FileName,faAnyFile,Rec);
        ListBox1.Items.Add('文件名:'+Rec.Name);
        ListBox1.Items.Add('大小:'+IntToStr(Rec.Size));
        ListBox1.Items.Add('属性:'+IntToStr(Rec.Attr)); //属性要对应的去找
      end;
    end;
      

  4.   

    加上一楼的代码var
      Rec :TSearchRec;
      i:integer;
    begin
      OPenDialog1.Options :=[ofHideReadOnly,ofAllowMultiSelect,ofEnableSizing];
      if (OpenDialog1.Execute) and (OpenDialog1.FileName<>'') then
      begin
        for i:= 0 to OpenDialog1.Files.Count -1 do
        begin
          Rec.Name := OpenDialog1.Files[i];
          ListBox1.Items.Add('&Icirc;&Auml;&frac14;&thorn;&Atilde;&ucirc;:'+Rec.Name);
          ListBox1.Items.Add('&acute;ó&ETH;&iexcl;:'+IntToStr(Rec.Size));
          ListBox1.Items.Add('&Ecirc;&ocirc;&ETH;&Ocirc;:'+IntToStr(Rec.Attr));
          ListBox1.Items.Add('&acute;&acute;&frac12;¨&Ecirc;±&frac14;&auml;:'+IntToStr(Rec.Time));
          ListBox1.Items.Add('');
        end;
      end;
      

  5.   

    刚才有乱码..
    var
      Rec :TSearchRec;
      i:integer;
    begin
      OPenDialog1.Options :=[ofHideReadOnly,ofAllowMultiSelect,ofEnableSizing];
      if (OpenDialog1.Execute) and (OpenDialog1.FileName<>'') then
      begin
        for i:= 0 to OpenDialog1.Files.Count -1 do
        begin
          Rec.Name := OpenDialog1.Files[i];
          ListBox1.Items.Add('文件名:'+Rec.Name);
          ListBox1.Items.Add('大小:'+IntToStr(Rec.Size));
          ListBox1.Items.Add('属性:'+IntToStr(Rec.Attr));
          ListBox1.Items.Add('创建时间:'+IntToStr(Rec.Time));
          ListBox1.Items.Add('');
        end;
      end;
      

  6.   

    不是在listbox里面啊,我在listview里面添加了columns:文件名,文件路径,大小…………
    我要这些东西显示在listview里面啊!