Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

SHBrowseForFolder API call - HOW??

12 views
Skip to first unread message

Adrian Pegram

unread,
Nov 11, 1997, 3:00:00 AM11/11/97
to

Does anyone have an idea how to use the SHBrowseForFolder API from VB 5, on
a NT 4.0 WS.

I need to be able to browse (as in the browse button of "Find File") for
folders across my local drives, or the Network.

If a control exists that can do a similar thing, that would also be OK.

Any help is appreciated.

Thanks

Ade

Domenico Statuto

unread,
Nov 11, 1997, 3:00:00 AM11/11/97
to

This attached is a sample of BrowseForFolder. If you want a very powerful
(yet free) Activex Control, check the website in my signature for Brad
Martinez' BrowseForFolder control.

--
Check Common Controls Replacement Projects ActiveX controls at:
http://www.zeode-sd.com/ccrp/
Domenico Statuto


Adrian Pegram <no-spam...@jba.co.za> wrote in article
<649lji$9us$1...@hermes.is.co.za>...

begin 600 BrowseFolder.zip
<encoded_portion_removed>
end


Ben Baird (MSMVP)

unread,
Nov 11, 1997, 3:00:00 AM11/11/97
to

Take a look at the Browse Dialog control at the Common Controls Replacement
Project (CCRP) homepage. The address is in my signature.
--
Ben Baird, MVP
Microsoft SiteBuilder Network Level 2
Visual Basic Thunder, version 2.0
http://www.cyberhighway.com/~psy/
Common Controls Replacement Project, Official Member
http://www.zeode-sd.com/ccrp/

Adrian Pegram wrote in message <649lji$9us$1...@hermes.is.co.za>...

Adrian Pegram

unread,
Nov 12, 1997, 3:00:00 AM11/12/97
to

Domenico Statuto wrote in message <01bceeb3$f414ece0$01b01fc3@domenico>...


>This attached is a sample of BrowseForFolder. If you want a very powerful
>(yet free) Activex Control, check the website in my signature for Brad
>Martinez' BrowseForFolder control.


<SNIP>

Thanks guys, the sample is great, and so is the control. Using the sample,
how would I set the root folder (or starting folder) of the browse?

TIA

Ade

Domenico Statuto

unread,
Nov 12, 1997, 3:00:00 AM11/12/97
to

You should set the pidl field of the Browseinfo structure, but I can't help
you, sorry. Iwill forward your request to Brad Martinez.


--
Check Common Controls Replacement Projects ActiveX controls at:
http://www.zeode-sd.com/ccrp/
Domenico Statuto

Adrian Pegram <no-spam...@jba.co.za> wrote in article

<64c7eo$rkt$1...@hermes.is.co.za>...

Domenico Statuto

unread,
Nov 12, 1997, 3:00:00 AM11/12/97
to

The RootFolder prop will set a chosen dir as the root (i.e. it's not
possible to browse folders 'above' that), while the SelectedFolder prop set
the folder initially selected when the dialog is displayed.

Brad Martinez

unread,
Nov 12, 1997, 3:00:00 AM11/12/97
to

Adrian,

> Thanks guys, the sample is great, and so is the control. Using the sample,
> how would I set the root folder (or starting folder) of the browse?

Have to set the pidlRoot member of the BROWSEINFO struct. For
special shell folders (My Computer, Start Menu, etc.) you can use
the SHGetSpecialFolderLocation API to get the folder's pidl (pointer
to an item id list). I didn't see what Domenico sent, but I show how
to do this in the BrowseDlg demo on my site.

To obtain the pidl for a "non special" file system folder, there are a
couple of choices. The hard and correct way to do this is to encapsulate
the IShellFolder interface and call it's ParseDisplayName member
function. The EnumDeskVB example on my site also shows how to
do this.

The easy and not guaranteed to always work way is to use the
undocumented SHSimpleIDListFromPath Shell32.dll function. Here's
the declare:

Declare Function SHSimpleIDListFromPath Lib "shell32" Alias "#162" _
(ByVal szPath As String) As Long

Some things to consider about this function: First the function is
exported at the specified ordinal in both Win95's and IE4's version
of Shell32.dll (versions 4.00.950(1) and 4.71 respectively) but there
is nothing that says it will be at this ordinal or available at all in future
versions of the library. Secondly, szPath must be specified as an
ANSII string in Win95, and as a Unicode string when called on WinNT.
Finally the function's name is misleading. This may not make much
sense, but the function returns an absolute pidl (or "complex" pidl, as
opposed to "simple"), relative to the desktop folder. See the SDK to
learn more on pidls.

It's your call... Oh, and thank you too. Domenico as well.

--
Brad Martinez
http://members.aol.com/btmtz/vb

Common Controls Replacement Project
http://www.zeode-sd.com/ccrp/

0 new messages