ShellClass Items Collection problem

  • Thread starter Thread starter Jeff McLaughlin
  • Start date Start date
J

Jeff McLaughlin

Hello,

I'm trying to programatically scan the contents of the "My Bluetooth
Places\Entire Bluetooth Neighborhood" to see my local Bluetooth devices. I
can use the shell object, and scan the contents of the desktop to get to the
My Bluetooth Places folder, but the Items collection is empty (which is
wrong--it does contain Entire Bluetooth Neighborhood). If I call
BrowseForFolder I can pick the folder manually. I just can't get to it
programatically. Here's a code snippet. When the BrowseForFolder dialog
pops up, I choose "My Bluetooth Places\Entire Bluetooth Neighborhood", and
get a pointer to the folder (okay so far). But, when I basically do
folder.ParentFolder.Items().Count it comes back that it's parent folder has
0 items. How is that possible? The fact that the "Entire Bluetooth
Neighborhood" folder has a pointer to it's parent clearly means that the
windows shell is aware of that relationship...

Thanks.

Shell32.ShellClass shell = new Shell32.ShellClass();

Shell32.Folder fEntire_Bluetooth_Neighborhood =
shell.BrowseForFolder(0,"Pick Entire Bluetooth Neighboorhood",0,null);

Shell32.Folder fMy_Bluetooth_Places =
fEntire_Bluetooth_Neighborhood.ParentFolder;

// Now fMy_Bluetooth_Places points to My Bluetooth Places

// and fEntire_Bluetooth_Neighborhood points to My Bluetooth Places\Entire
Bluetooth Neighborhood

Shell32.FolderItems childItems = fMy_Bluetooth_Places.Items(); // take the
child folder, see how many items the parent contains

int Count = childItems.Count; // Count is 0. How's that possible. It
contains me?
 
Back
Top