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 wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

browse for folder with create folder feature

Status
Not open for further replies.

debaser003

Programmer
Jan 25, 2004
2
US
I would like to find a way to allow a user to browse for a folder using a treeview in which desktop, documents and network are represented, but also have an command button and textbox for creating a new folder on the selected node.

The windows browse for folder code doesn't seem to allow for adding this feature, and I'm not sure how to set up a treeview to include everything that can be explored.

I'd appreciate anyone's advice.

Thanks

debaser003

 
Hi, and welcome to Tek-Tips.
Being a new member you are advised to go through FAQ222-2244 which gives useful guidelines and tips regarding the usage of this forum.

Now about your question.

To enable the user create new folders you need to use the extended user interface of the browse-for-folder dialog. This extended UI is enabled by specifying the BIF_USENEWUI flag in the ulFlags member of the BROWSEINFO structure that is passed to the SHBrowseForFolder function. The value of this flag is 64.

An example of browse-for-folder dialog is presented in thread222-498611 but it is also with simple interface without having the New Folder button.

To get the New Folder button declare the BIF_USENEWUI constant in your code.
Const BIF_USENEWUI = &H40&

And modify the line in And the BrowseFolder function:
bi.ulFlags = BIF_RETURNONLYFSDIRS Or BIF_STATUSTEXT

to this:
bi.ulFlags = BIF_RETURNONLYFSDIRS Or BIF_STATUSTEXT Or BIF_USENEWUI

This will allow the users to create new folders as well as access the context menus of the folders, which are otherwise, not accessible.
 
Hi,

I need to have browse with create folder feature in my project.

I made the changes as suggested above to be able to create a new folder. I'm not able to create a folder. I am only able to browse. Can you please tell me what's the mistake I'm making ? I need this functionaltiy. Please help.
 
The BIF_USENEWUI flag is supported only by Shell32.dll Version 5.0 or later.

Older platforms, Windows NT, Windows 95 and Windows 98 are distributed with older versions.

That is why it only works on Windows Me, Windows 2000, Windows XP and Windows 2003.
 
But I am using windows 2003 server. What else could it be ??
 
I just now tried on windows XP at home and it is working fine. At work I have windows 2003 and I was not able to create folder.
 
I have no idea...
The code works for me... and hope, for others too.
I just tested it on my PC running XP. Never got a change to check on Windows 2003.
 
Thanks Hypetia. It is working Fine. I made a little mistake in
bi.ulFlags = BIF_RETURNONLYFSDIRS Or BIF_STATUSTEXT Or BIF_USENEWUI

What I did was, commented the original bi.ulFlags that was there and instead of pasting this in its place, put it below pidl = BrowseForFolder(bi) by mistake.

Thanks again.


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top