Article View: borland.public.cppbuilder.nativeapi
Article #2627Re: SHBrowseForFolder and filtering
From: Bob Gonder
Date: Wed, 07 Feb 2007 17:48
Date: Wed, 07 Feb 2007 17:48
49 lines
2745 bytes
2745 bytes
Mike Collins wrote:
>Hi all, can anyone point me in the right direction with this -not sure if it
>is possible though.
Sounds COMplicated but doable.
(I haven't done it, just reading the docs...)
>I 'm using the SHBrowseForFolder api to display a browser dialog. However,
>i want to control what is displayed, and thus selected within this dialog.
>I want to limit the users display to only removale drives, CD / DVD drives
>and folders within these drives. I've coded a custome callback for the
>browser but i'm not sure what messages to look for and how to process then.
The remarks section here
http://msdn2.microsoft.com/en-us/library/ms647664.aspx
mentions Custom Filtering (with 6 steps)
Step3
You will be catching BFFM_IUNKNOWN message in your callback
http://msdn2.microsoft.com/en-us/library/ms649522.aspx
case BFFM_IUNKNOWN:
IFolderFilterSite* FFS;
((IUnknown*)lParam)->QueryInterface( Unsure, &FFS );
Step 5
Then making your COM filter interface available to the dialog.
http://msdn2.microsoft.com/en-us/library/ms645491.aspx
FFS->SetFilter( MyIUnknownCOMInterfaceThatHasAnIFolderFilter);
Step 6
FFS->Release();
Step 4
You would then need a COM Interface
(MyIUnknownCOMInterfaceThatHasAnIFolderFilter) that returns a pointer
to an IFolderFilter which implements your 2 filtering procs.
http://msdn2.microsoft.com/en-us/library/ms645494.aspx
In particular your IFolderFilter::ShouldShow() method returns S_OK to
show and S_FALSE to hide.
http://msdn2.microsoft.com/en-us/library/ms645496.aspx
Apparently after all that, the dialog automatically calls your COM
filters for each item.
COM interfaces are currently beyond my knowledge base.
Perhaps you have ventured there?
Technical Details
Message-ID:
<6f0ks2166gv2qvl1v7oq0kofrmitcu4mio@4ax.com>Path:
arc1-ca.pugleaf.net!g2news2.google.com!news3.google.com!news4.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mailReferences:
<45c9eb0a@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,44855005298c82e X-Google-Attributes: gid10cc67,public X-Google-Language: ENGLISH,ASCII-7-bit From: Bob Gonder <notbg@notmindspring.invalid> Newsgroups: borland.public.cppbuilder.nativeapi Subject: Re: SHBrowseForFolder and filtering Date: Wed, 07 Feb 2007 09:48:44 -0800 Organization: MindSpring Enterprises, Inc. Reply-To: notbg@notmindspring.invalid Message-ID: <6f0ks2166gv2qvl1v7oq0kofrmitcu4mio@4ax.com> References: <45c9eb0a@newsgroups.borland.com> X-Newsreader: Forte Agent 1.93/32.576 English (American) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit NNTP-Posting-Host: 69.69.88.225 X-Trace: newsgroups.borland.com 1170870521 69.69.88.225 (7 Feb 2007 09:48:41 -0800) Lines: 51 Path: arc1-ca.pugleaf.net!g2news2.google.com!news3.google.com!news4.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail