Browse for Folders Dialog

Hi all!

I have started creating my first ever MFC application, and although I
can use DoModal() to open a 'Browse for Files' dialog, I can't seem to
filter it so that I can select a folder instead of a file withing that
folder. Is there any Windows-specific way I can do this without having
to use a separate class? If not, would anyone know if Boost supports
this?

Thanks in advance.

Daz

0
cutenfuzzy (18)
5/20/2006 11:32:34 AM
vc.mfc 33608 articles. 0 followers. Follow

5 Replies
889 Views

Similar Articles

[PageSpeed] 45

Take a look at SHBrowseForFolder:

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/shellcc/platform/shell/reference/functions/shbrowseforfolder.asp

----
Ajay

0
ajaykalra (6842)
5/20/2006 11:42:10 AM
Ajay Kalra wrote:

> Take a look at SHBrowseForFolder:
>
> http://msdn.microsoft.com/library/default.asp?url=/library/en-us/shellcc/platform/shell/reference/functions/shbrowseforfolder.asp
>
> ----
> Ajay

Thanks Ajay! It seems a little confusing, but I will try and figure it
out. Just out of interest, how would I declare the instance of
CFileDialog before doing DoModal(), so that it only shows files with a
particular extension? For example, *.exe, and maybe even change the
dialog title?

Best wishes.

Daz

0
cutenfuzzy (18)
5/20/2006 12:00:04 PM
See lpszFilter argument of CFileDialog constructor (and other arguments). To 
change the dialog title you need to access m_ofn directly, which is not good 
part of design of CFileDialog.

"Daz" <cutenfuzzy@gmail.com> wrote in message 
news:1148126404.204472.14640@g10g2000cwb.googlegroups.com...
>
> Ajay Kalra wrote:
>
>> Take a look at SHBrowseForFolder:
>>
>> http://msdn.microsoft.com/library/default.asp?url=/library/en-us/shellcc/platform/shell/reference/functions/shbrowseforfolder.asp
>>
>> ----
>> Ajay
>
> Thanks Ajay! It seems a little confusing, but I will try and figure it
> out. Just out of interest, how would I declare the instance of
> CFileDialog before doing DoModal(), so that it only shows files with a
> particular extension? For example, *.exe, and maybe even change the
> dialog title?
>
> Best wishes.
>
> Daz
> 


0
alegr (1131)
5/20/2006 1:19:11 PM
Alexander Grigoriev wrote:

> See lpszFilter argument of CFileDialog constructor (and other arguments). To
> change the dialog title you need to access m_ofn directly, which is not good
> part of design of CFileDialog.
>
> "Daz" <cutenfuzzy@gmail.com> wrote in message
> news:1148126404.204472.14640@g10g2000cwb.googlegroups.com...
> >
> > Ajay Kalra wrote:
> >
> >> Take a look at SHBrowseForFolder:
> >>
> >> http://msdn.microsoft.com/library/default.asp?url=/library/en-us/shellcc/platform/shell/reference/functions/shbrowseforfolder.asp
> >>
> >> ----
> >> Ajay
> >
> > Thanks Ajay! It seems a little confusing, but I will try and figure it
> > out. Just out of interest, how would I declare the instance of
> > CFileDialog before doing DoModal(), so that it only shows files with a
> > particular extension? For example, *.exe, and maybe even change the
> > dialog title?
> >
> > Best wishes.
> >
> > Daz
> >

Thanks guys! I am off to read up on the suggested topics. :)

0
cutenfuzzy (18)
5/20/2006 1:24:00 PM
You can use SHBrowseFor folder which will work fine for your
convenience providing sample code

                  BROWSEINFO bi;

	char Dest[MAX_PATH],szDirPath[MAX_PATH];
	char Folder[MAX_PATH];
	ITEMIDLIST* pItemIDList;
	pItemIDList = NULL;
	memset(&bi, 0, sizeof(bi));
	bi.hwndOwner = m_hWnd;
	bi.pszDisplayName = Folder;
	bi.lpszTitle = "Choose the destination folder";// Set the title of
browse dialog.
	bi.ulFlags = BIF_NEWDIALOGSTYLE;
	bi.lpfn = NULL;
	lstrcpy(Dest,"");
	lstrcpy(szDirPath,"");

	pItemIDList = SHBrowseForFolder(&bi);
	if(pItemIDList != NULL)
// Here the call for browsing folder
		SHGetPathFromIDList(pItemIDList, Dest);
	lstrcpy(szDirPath,Dest);

0
mesushant (27)
5/22/2006 7:14:22 AM
Reply:

Similar Artilces:

Setting calendar permissions when you are owner of calendar folder only (no access to open rest of mailbox)
Hi The office runs an Exchange system. We use Outlook 2000 clients. There are four people who have given me 'owner' access to their calendars, so as I may grant or revoke administrative staff access as needed. However, without having futher permissions to their calendars, I can't find a way of doing this. I can only see how to do this when the mailboxes are added to my Exchange profile and every folder opened by outlook. Although I can open the calendar only using the "file -> open -> other users folders" method. This doesn't allow me to see/change the permi...

Two different Dialog layouts for the same program, how?
Is it possible to create two dialogs resources for the same application and choose one on startup ? For example, if a user has a 1280x1024 display, use one resource dialog... if they don't, use another instead. I've already created the application with the first dialog (dialog editor designed), and the class is already "attached" to the dialog. I don't want to duplicate the whole class to get the functionality of the GUI's buttons, etc. in the second dialog layout. Is this doable? -- dhomas trenn founder, creative interpreter - young monkey -----------------------...

Dialog Background Color not Refreshing
Hello all... hope you can help -- burned through like 5 hours and no progress.... VC++ 6.0: I am changing a dialog background to red when another dialog in my program is open. Then when the popup window has closed, the background of the base dialog goes back to its original gray color. Well, my solution almost works except 1/2 of the base dialog will not change to red or back to it's original color unless you wipe over it with a dialog somewhere else on the desktop... this seems to invalidate the rest of the region and it repaints that part of the dialog correctly. I have tried...

AutoArchive creates new Personal Folders object (3'rd request for help)
Using Outlook 2002 (10.3513.3501) SP-1. Whenever I run an AutoArchive, it finishes with an 'operation failed' = error, and a new folders object named 'Personal Folders' is created. The = new folder is not linked to a .PST, and is easily removed using the Data = Files dialog. However, it returns with each AutoArchive. :-( Is there a solution to the problem? I found a posting that suggested that the deletion of all the name/value = pairs of the profile's registry key might solve a similar problem. What = potential problems might result from attempting this? I'd of cour...

OWA after logon show folders in ftp type view
After successfully logging on to OWA on the Exchange server, instead of the normal Outlook like view, I get an ftp type view with mail.myserver.com - /exchange/ at the top, followed by a "Parent Folder" link and an ls style list of folders/directories. The directories are clickable links and match the list of email users. Only the folder for name logged on works. Clicking any other user link takes the user back to the OWA logon screen. The logged on user gets a list of folders that match the normal OWA folder display (Calendar, Contacts, Inbox, etc.), again in an ls style list...

Outlook 2003, View
In Outlook 2003 I click View | Arrange By | Current View | Define Views. In the Custom View Organizer higlight IMAP Messages, click Modify, make changes, click OK to close the 'Customize View: IMAP Messages' window, and click Apply View in the Custom View Organizer window. When I view another IMAP mail folder, I have to go through the same steps again and again. The view for all mail folders show IMAP Messages, but the set view is not taking affect. Is this a bug in Outlook 2003? I am trying to set all the IMAP mail folders to a particular view that I like to use, but it seems like...

Outlook Auto Resolve Distribution List in Contact Folder In Public Folder
We're running Outlook 2000 and Exchange 2000. I have a Distribution List called DL1 in a Contacts Folder called CF1 in a Public Folder called PF1. When I type DL1 in the To: field of an email and click "Check Names" Outlook is unable to resolve the name of the Distribution List. But it resolves non Distribution List entries just fine. To set this up, I right clicked CF1, clicked Properties, Outlook Address Book, and placed a check mark in front of "Show this folder as an e-mail address book". In Outlook I clicked Tools, Services, Addressing and added CF1 ...

Problems moving Microsoft Date and Time Picker Control on MFC dialog
I've got an MFC CDialog class that displays and manages a dialog. There are several controls on the dialog (combo boxes, edit boxes, static text boxes, etc.). Included in the mix are four Microsoft date and time picker controls. The dialog is used in three separate instances. Not all of the controls are relevant in all three instances so we hide the controls that aren't relevant in each instance, move the controls around on the screen, and resize the dialog to eliminate dead areas on the dialog. We are getting the CWnd for each control and using the SetWindowPos method for each control...

separate outlook folders for different email accounts
one of my email accounts started depositing their messagees in my business account in box last week. I cannot find any information easily to help me find out how to keep these email accounts segregated so i made a special rule and that took care of the problem until i signed in again the next day. I need my accounts to deliver into their proper folders...please advise. "scb" <scb@discussions.microsoft.com> wrote in message news:DCEA2113-23D7-4053-91E8-18C07E8147ED@microsoft.com... > one of my email accounts started depositing their messagees in my business ...

downloaded office 2007can't find old folders and address book
Any way I can find the folders I created to save emails? Or my address book? If you used outlook thay are contained within the outlook data file, by default outlook.pst You should search to include hidden for that, or *.pst Only outlook can access this data file "Merry L" <Merry L@discussions.microsoft.com> wrote in message news:B84479A9-20AA-4E10-9C92-3258F437A6FC@microsoft.com... > Any way I can find the folders I created to save emails? Or my address > book? ...

Cancel Button on Category Maintenance Dialog Box
No Name Dialog Box: Text: Do you want to save changes to this record? Options: Save Delete Cancel You’re in a Cost Category making changes. Something happens and you don’t want to save them. If you click the ‘Cancel’ option on the dialog window you return to the changed status of the cost category. If you don’t want to Save and you click Delete (thinking the window will Delete the changes) one of two things happens: A) If there are no posted costs the Cost Category itself will be Deleted from the Project, or B) If there are posted costs you get a 'Cannot Delete due to poste...

Toggle Folder Colors
I don't think MS has this feature, but I'd like to see it built into the software if it's not already there. I'd like to toggle the color of folders by going into the "properties" tab and not by needing to replace the icon. Right now the folders are all plain manila. We like to keep all proposal and project folders in the directory until the end of the year, but some of the proposals never went anywhere. I'd like to change these to a different color, like red, once they became dead ends and make them quickly distinguishable between live and dead ones...

Can't Find Contact Folder?
When I click the contact folder I Outlook "cant find the folder". Where is this setting so I can see which folder it's looking for? .... version Outlook XP Sorry about that. Microsoft Outlook 2003 running on Windows XP. In Outlook, there is not a seperate file for contacts. It is part of the same pst file as the other folders. Never heard of this before, so this may not work, but since OL does not believe thecontact folder is there it might. Right click Personal Folders and select New Folder, name it Contacts and see what happens. Worst that could happen is that it will ...

How to get the ID of a dialog?
Hello all: I create a single document and insert resouce,and then select Dialog,I find this dialog's resource ID is IDD_DIALOG1,I want to know how to get this dialog's ID?thanks. CWnd::GetDlgCtrlID() ----- Ajay Kalra ajaykalra@yahoo.com Lee Tow wrote: > Hello all: > I create a single document and insert resouce,and then select > Dialog,I find this dialog's resource ID is IDD_DIALOG1,I want > to know how to get this dialog's ID?thanks. > > GetWindowLong(hwnd, GWL_ID); -- Scott McPhillips [VC++ MVP] > I create a single document and i...

Item search on multiple folders in exchange public folder
I am trying to perform an item search on multiple folders that was created in the Exchange Public folder, how can I do it? I am using outlook 2002 that access Exchange Public folder in Exchange server 5.5. Thanks for your help, SH ...

Update copies of contacts in multiple folders
I have copies of contacts copied to multiple folders, such as CONTACTS and FAMILY. When I edit one copy the other is not updated. How do I synchronize all copies of a contact? -- JK Well this is because these are separate items and they don't hold a link. You can't synchronize those folders. You are probably better of assigning categories to your contacts and then use views to show only a specific category. This way you don't have to duplicate your items either. -- Robert Sparnaaij [MVP-Outlook] www.howto-outlook.com Tips of the month: -What do the Outlook Icons Mean? -...

how to export public folder path
hi, how can I export the complete path of all my public folders,like I can with users, for instance with 'ldif': CN=first lastname,OU=It,OU=Technical,OU=departm ents,DC=company,DC=com the only place where I see the path is in the GUI in the properties of the public folder,->general->path but I need to export all 100 pf's. in ADU&C I see the MS EX System Objets,but again no tree structure. any help is appreciated, thanx, martin martin koeb <nospam.mko@at.tiscali.com.nospam> wrote: [ snip ] >the only place where I see the path is in the GUI in the p...

Public Folders #3
Hello, Does anyone know how to mark a message as read for a public after one person reads it. So that when other people look at the message it shows up as being read. "Justin" <jfrancis@mercy.com.au> wrote: >Does anyone know how to mark a message as read for a >public after one person reads it. So that when other >people look at the message it shows up as being read. Not that I know of. A public folder will either keep the read/unread state of a message for each user or it will not manage the state at all. -- Rich Matheisen MCSE+I, Exchange MVP MS Exchange ...

IE8 Print->Print->Page Setup doesn't open dialog
I am on Windows 7 x64 with IE8 (32-bit). When I try to open the page setup dialog it does nothing. Ok, well it does the blue ring for a second or two then no dialog. I tried lots of things including rebooting and still no dialog. It works on IE8 (64-bit) just not IE8 (32-bit). Extra info: Yes, I looked around for dialog on other screen, under other windows, under my desk, etc. :-) The print preview works (except for the page setup button on it). The print works and it does print. IE8 Version: 8.0.7600.16385 Update Versions: 0 Win 7 Ultimate I ran win update and found 1 IE8 sec...

Public Folder Contact list export
I have a Public Folders Contact list that I need to export to an Excel format. In Outlook 2003 when I go to File-Import and Export, it does not list any Public Folders. How can this be done? Copy Contacts from PF to your mailbox or an Outlook PST folder and export to file. -- Bharat Suneja MCSE, MCT www.zenprise.com blog: www.suneja.com/blog ----------------------------------------- "MikeO" <MikeO@discussions.microsoft.com> wrote in message news:804F410F-A76D-44C5-BD85-C47DD5DF127D@microsoft.com... >I have a Public Folders Contact list that I need to export to an E...

Open of automatic folder
Hi We have a folder called Market Intelligence where we have a record called welcome. At the moment you have to double-click on the folder Market Intelligence and the double-click on the record before the welcome text appear. To avoid a double-click we want the record Welcome to open automatically when double-click on the folder Market Intelligence. Best regards Henrik ...

why 2 'sent items' folders when 1 isn't used?
Whenever I send an email a copy is stored in the sent items folders of my default account. I would prefer to have it saved in the sent items folder of my storage folders, but can't find any way to make that happen. Why have that second folder if it is not used? Mail accounts use the Sent Items folder within the account folder. Newsgroup messages use the Storage folders/Sent Items folder - ie..the second folder is used. -- ...winston ms-mvp mail "corystes" <corystes@discussions.microsoft.com> wrote in message news:C0374B5A-7A93-40CF-939C-921E5...

All messages going to incorrect folder
Version: 2008 Operating System: Mac OS X 10.5 (Leopard) Processor: Intel Email Client: pop We tried to create a rule for certain messages to go directly into folder A. It seems all incoming and sent messages are going there and we could not change the rule. Tried deleting the folder but all messages followed the folder to 'Deleted Items' so we moved the folder back under 'Inbox'. Now we cannot find the rule to change or delete it. <br> How do we direct incoming messages to 'Inbox' and sent messages to 'Sent Items'?? <br> Thanks On 3/21/1...

Large no. of items in Public Folders
Hi, I have a situation at a customer’s site with regards to public folders on exchange 2000. Customer had set up Mail enabled public folders and is sending automatic e-mails to it (Like alerts, notifications, resumes etc). Most of them are very short messages. Over the period of time it has grown so large that it now has over 3 million items. Now the problem is they cannot open it. Well they can, provided they wait for 2 hours. And event then, any mouse click will again take 2 hours to respond. – in short they cannot use it. I had seen this behavior at other sites too. My question i...

Mail enabled public folder
We have several mail enabled public folders, or public folders that have distribution list membership. When an email message arrives in the public folder, it appears with a "note" icon instead of an envelope icon when we view the contents of the public folder in Outlook. I have Googled this but cannot find anything and am hoping to avoid using up a support case with MS on it. Anybody else have this problem? David-C-NetAdmin In news:IFGwf.1230$SD1.244@tornado.texas.rr.com, David-C-NetAdmin <reply-to-group-please@reply-to-group-please.thanks> typed: > We have sever...