From: Greg on
I'm looking for a way to not show the full path to a directory in a
dirlistbox. In other words, it should only show the relative path to the
directory I default it to be. We want users to only see "their" directory and
nothing above that.

I suppose I could do this with a listbox but it seems I would be reinventing
the wheel with navigating directory structure in a listbox.
From: Dave O. on
Hi

You can't "do this with a listbox", you will need a TreeView to simulate the
view in the DirListBox and the routine to iterate through the folders below
a given folder is quite simple if you have ever used the FindFirst, FindNext
& FindClose API triplet and depending on how many folders your users might
have, the code is really fast.
If your users have hundreds of folders you might find it better to rather
than iterate all the folders just do the first one or two levels then only
read more folders as a node is expanded - This is quite simple, you put a
placeholder in as the subdirectory, then before you expand the node check to
see if there is a placeholder or a actual folder, if there's the placeholder
you read the actual folders and remove the placeholder, sounds complex but
if coded well is very fast.
Also the Treeview is far more versatile, you can easily add a context menu
and allowing users to rename folders is far easier with a TreeView.

Regards
Dave O.

"Greg" <Greg(a)discussions.microsoft.com> wrote in message
news:63769F24-BFA1-4D2E-8546-2F1D56E96DD1(a)microsoft.com...
> I'm looking for a way to not show the full path to a directory in a
> dirlistbox. In other words, it should only show the relative path to the
> directory I default it to be. We want users to only see "their" directory
> and
> nothing above that.
>
> I suppose I could do this with a listbox but it seems I would be
> reinventing
> the wheel with navigating directory structure in a listbox.


From: Karl E. Peterson on
Greg wrote:
> I'm looking for a way to not show the full path to a directory in a
> dirlistbox. In other words, it should only show the relative path to the
> directory I default it to be. We want users to only see "their" directory and
> nothing above that.

You can use SHBrowseForFolder and set the BROWSEINFO.pidlRoot to point wherever you
want. I don't have a good example handy, but you'd use either
SHSimpleIDListFromPath or SHGetSpecialFolderLocation to set that value.
--
..NET: It's About Trust!
http://vfred.mvps.org