Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Selecting a file or a directory with a dialog

Status
Not open for further replies.

REWT

Programmer
Aug 10, 2001
12
US
I have a CFileDialog object to open a file, however, I want to be able to select a directory or a file and I cant figure out how to do this with a dialog window. Is this possible. If not, is there a component for VC++ 6.0 where I can do this. Thanks in advance.

Ryan E-W Taylor
 
I think you need CFileOpen. It is a system resource dialog for file finding. Or see GetOpenFileName/GetSaveFileName John Fill
1c.bmp


ivfmd@mail.md
 
Do you happen to have any sample code for CFileOpen? Thanks again.

REWT
 
In WinAPI not, but in MFC just create an instance of CFileOpen and go on. In WinAPI you can use GetOpenFileName/GetSaveFileName. I have some pieces of codes in my programs. John Fill
1c.bmp


ivfmd@mail.md
 

Hi,

When you create a MDI or SDI application this support is build into the frame work for you. Create an SDI application then run the debugger and step through the program to find out what class is used. There is a save and open dialog class but I can't remeber what they are.

Brother C

 
GetOpenFileName/GetSaveFileName will only browse for files. if you want to browse for a folder you should use ethe ShellApi function SHBrowseForFolder.

Hope this helps, s-)

Blessed is he who in the name of justice and goodwill, sheperds the weak through the valley of darkness...
 
yes, you could use SHBrowseForFolder for folders, but is up to you which one to use. I prefer GetOpenFileName/GetSaveFileName in both cases. John Fill
1c.bmp


ivfmd@mail.md
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top