aha! Fehler gefunden! So is es richtig!
Delphi-Quellcode:
function SelectedFiles(AShellView: TShellListView): TStringList;
var i: Integer;
begin
Result := TStringList.Create;
for i := 0 to AShellView.Items.Count - 1 do
// is the item selected?
if AShellView.Items[i].Selected = True then
// Folders can also refer to files, which is why we check isFolder
// before adding the filepath to the result
if AShellView.folders[i].IsFolder = False then
// add filepath and filename to result
Result.Add(AShellview.Folders[i].PathName);
end;
// ---------- Usage: -------------------------------------------------
procedure TForm1.Button1Click(Sender: TObject);
var
i: Integer;
FileList: TStringList;
begin
try
FileList := TStringList.Create; //create stringlist to contain filenames
FileList := SelectedFiles(ShellListView1); //populate tstringlist
if FileList.Count = 0 then Exit; //exit if no files selected
for i := 0 to FileList.Count - 1 do
ShowMessage(FileList[i]); //cycle through each filename and do something
finally
FreeAndNil(FileList); //free tstringlist when finished
end;
end;