How to add My Documents to a TreeView

  • Thread starter Thread starter SamSpade
  • Start date Start date
S

SamSpade

I'm looking at using a TreeView control and can see how to fill in
MyComputer with directory and file names.

But I have no idea of how to include things like My Documents and My Network
Places

Anyone how to do that.


Thanks
 
Stuff like My Computer and My Network Places you have to add manually while filling the treeview, as you cannot scan recursively through drives/directories to find them. Mapped network drives can be added as drives, and you can use the FileScriptingObject to determine the type of drive they are and so apply the correct icon (by using the shell to determine the default icon for the specific type of drive). My Documents is a type of "special folder" that is different for each user, so you'll have to add the tree view item and icon manually in your code, determine which user is logged in, then locate the path within Documents and Settings that applies to that particular user's My Documents folder, and remember to open that path when the item is activated. As far as determining attached saved network connections to add to the My Network Places folder, you'll probably have to use the shell for that too. Unless you really want to, I'd download a control or use the Open Directory dialog to do what you want to do, as it gets a little intensive programmatically
 
as it gets a little intensive programmatically.

Sure sound like it, but I cut your reply and paseted into my code and am
going to give it a try.

Thanks
Cal
 
Back
Top