Mega Code Archive

 
Categories / Delphi / Files
 

How to retrieve the path of the selected file in a TShellListView

Title: How to retrieve the path of the selected file in a TShellListView { 1. } Label1.Caption := TShellFolder(ShellListView1.RootFolder).PathName; { 2. } var p: TPoint; item: TListItem; begin GetCursorPos(p); p := ShellListView1.ScreenToClient(p); item := ShellListView1.GetItemAt(p.X, p.Y); if item nil then Caption := item.Caption end; // But this works: // Aber so geht's: Label1.Caption := ShellListView1.Folders[ShellListView1.ItemIndex].PathName {**************************************************************} { To retrieve full paths to each file selected files: } var path: string; begin for i:=0 to ShellListView1.SelCount-1 do begin path := ShellListView1.Folders[ShellListView1.GetNextItem(ShellListView1.Selected, sdAll,[isSelected]).Index+i-1].PathName; // ... end; end