Получить путь к выделенному файлу в TShellListView
Falk0ner, вс, 06/07/2008 - 15:34.
Получить путь к выделенному файлу в TShellListView
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.GetItem(ShellListView1.Selected,
sdAll,[isSelected]).Index+i-1].PathName;
// ...
end;
end
{**************************************************************}
{
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.GetItem(ShellListView1.Selected,
sdAll,[isSelected]).Index+i-1].PathName;
// ...
end;
end
Взято с сайта: http://www.swissdelphicenter.ch
а так не проще... полный путь к каждому выделенному файлу
path: string;
i: integer;
begin
for i:=0 to ShellListView1.Iems.Count-1 do
if ShellListView1.Iems[i].Selected then
begin
path:= path+ShellListView1.Folders[i].PathName + #0;
// ...
end;
end
Второй способ по сути единственный из встреченных мною в сети, который позволяет получить данные файлов, выделенных не подряд, через shift, а с "дырками".
Отправить комментарий