//你可先得到我的电脑的ItemID,得到一个ishellfolder,然后用ishellfolder.enumobjects边历每一个子folder,getdisplayname(folder)
if ='拨号网络‘,then ishellfolder.bindtoobjects;
就可得到itemid
//你可以参考/demos/virtual listview中的例子
procedure TForm1.PopulateIDList(ShellFolder: IShellFolder);
const
Flags = SHCONTF_FOLDERS or SHCONTF_NONFOLDERS or SHCONTF_INCLUDEHIDDEN;
var
ID: PItemIDList;
EnumList: IEnumIDList;
NumIDs: LongWord;
SaveCursor: TCursor;
ShellItem: PShellItem;
begin
SaveCursor := Screen.Cursor;
try
Screen.Cursor := crHourglass;
OleCheck(
ShellFolder.EnumObjects(
Application.Handle,
Flags,
EnumList)
);
FIShellFolder := ShellFolder;
ClearIDList;
while EnumList.Next(1, ID, NumIDs) = S_OK do
begin
ShellItem := New(PShellItem);
ShellItem.ID := ID;
ShellItem.DisplayName := GetDisplayName(FIShellFolder, ID, False);
ShellItem.Empty := True;
FIDList.Add(ShellItem);
end;
FIDList.Sort(ListSortFunc);
//We need to tell the ListView how many items it has.
ListView.Items.Count := FIDList.Count;
ListView.Repaint;
finally
Screen.Cursor := SaveCursor;
end;
end;