Link to home
Start Free TrialLog in
Avatar of Wein
Wein

asked on

_ SHBrowseForFolder Shell API call.

Hi I am using C++Builder 5.

And I would like to call up the dialog that retrieves the folder path.

So I tried SHBrowseForFolder.

However, during compilation, the IDE gives me an error that many things in the shlobj.h are redifined...

(ex : FVSHOWINFO)

Maybe it's because I have to put something in my program to define API.. or WIN32... or...

But I don't know too much about making a shell call.

Can anyone teach me how to call SHBrowseForFolder successfully ?.
Avatar of jhance
jhance

Does C++ Builder have pre-compiled header files like VC++ does?  (I think it has a similar feature.)  If so, you are probably including shlobj.h once by default in there and then again explicitly in your source code.

I'd suggest taking a look at what is being included where and making sure you have it right.

You may also be mixing your Windows SDK versions.  If you have one that came with C++ Builder as well as one from MS, then you can get into this mess.

I don't think this necessarily has anything to do with SHBrowseForFolder, but rather is an issue with your project setup in C++ Builder.
Hi,
this may help:

http://www.bcbdev.com/faqs/faq62.htm

or at least you can compare your code to it to see if anythings wrong .
Avatar of Wein

ASKER

Thank you, inthe, for the useful information on SHBrowseForFolder.
It will really help my project for going on.

However, the focus of my problem is that i can't compile the file.

I included shlobj.h

Why does it show an error during compilation about ambiguish declaration ?

wein.
Wein, do you saw my reply to your same Q. in C++ area?
I quotate my reply:

From: AlexVirochovsky  Date: 08/11/2001 08:52AM PST  
Select Projects | Options.
Click the "Directories/Conditionals" tab on the dialog box.
Add NO_WIN32_LEAN_AND_MEAN to the list of conditionals.
Rebuild the entire project.

Alex
 
ASKER CERTIFIED SOLUTION
Avatar of Meir Rivkin
Meir Rivkin
Flag of Israel image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
its usage:

CSHBrowseDlg dlg;


if(m_dlgBrowse.DoModal() == IDOK)
{
     m_dlgBrowse.GetFullPath(); //the selected path
}

cheers
its usage:

CSHBrowseDlg dlg;


if(dlg.DoModal() == IDOK)
{
    dlg.GetFullPath(); //the selected path
}

cheers
Avatar of Wein

ASKER

Avatar of Wein

ASKER

Avatar of Wein

ASKER

Thanx everybody,
now it works like i wanted..
Avatar of Wein

ASKER

How should i give the points ?

I think NO_WIN32_LEAN_AND_MEAN did what I wanted...

but the others' comment help out too...
Avatar of Wein

ASKER

However, Alex, can you explain that conditional parameter ?

NO_WIN32_LEAN_AND_MEAN

I would like to know more about these flags...

1.
From Borland Doc:
...
Header file optimization and failed builds
-----------------------------------------------
(Enterprise and Professional editions only)

If a build fails with "can't find symbol" or
"multiple declaration" errors or with errors
that suggest that windows structures can't
be defined, you may need to add the following:
NO_WIN32_LEAN_AND_MEAN
to your project defines. This forces the .HPP
files in your project to include more of the Win32
header files, and should correct the build errors.

Such errors may be encountered if your project
includes a Pascal component that uses structures
from the ActiveX or shell object libraries
ACTIVEX.HPP, SHLOBJ.HPP, or URLMON.HPP.
(Structures were removed from these files to
reduce overall build times).

These errors may also be encountered when
compiling applications that include both
a windows header and the VCL version of
the same windows header. For example, including
both SHLOBJ.H and SHLOBJ.HPP will result in
compile time errors like the following:
 Multiple declaration for 'FVSHOWINFO'
 Multiple declaration for 'FOLDERSETTINGS'
 Multiple declaration for 'DESKBANDINFO'
 Multiple declaration for 'SHELLFLAGSTATE'

[CF81437]
....
2. About pts: If you want get points to me and
someone other, you can accept my comment as reply to your same Q. in "c++" area, and in this thread accept comment of other expert. Good Luck, Alex
Avatar of Wein

ASKER

where are located these documents ?
u can splityour points
Avatar of Wein

ASKER

how to split points sedgwick ?
go to "Community support", set "splitting points" as the title and write inside the link to the relevant question and the usernames to whom u wanna give the points.

good luck

the support will probably decrease the points from 100 to 50, so u can accept one anwser from one of the usernames and for the other ask new question adn in the title write
"points for ..."