How to filter by file type in IExplorerBrowser in Windows 7 libraries?

I created an instance of IExplorerBrowser in my code to create a custom I / O view in one of my dialogs. I implemented the IServiceProvider and ICommDlgBrowser interfaces in my host class. I use the IExplorerBrowser :: BrowseToIDList method to populate the view.

I would like to filter the displayed file types (for example, PNG files only). If I call BrowseToIDList using FOLDERID_Pictures (i.e., My Pictures), I can use the ICommDlgBrowser :: IncludeObject or IFolderFilter :: ShouldShow method to limit which files I can display. However, if I go to the image library in Windows 7 (FOLDERID_PicturesLibrary), neither ICommDlgBrowser :: IncludeObject nor IFolderFilter :: ShouldShow will be called.

Is there a restriction on filtering files in Win7 libraries that I donโ€™t know about? Perhaps I am missing an interface or perhaps I have indicated the wrong flag somewhere.

We will be very grateful for any ideas.

+4
source share
3 answers

I had the opportunity to explore this further, including asking a few questions to some Microsoft developers. Unfortunately, it seems that filtering does not work with requested queries (i.e. Libraries).

An alternative to my approach would be to use the "Regular Element" dialog with app add controls (via IFileDialogCustomize).

( http://msdn.microsoft.com/en-us/library/bb776913(VS.85).aspx )

In my particular case, I cannot use the Common Item dialog box, but I thought it might be worth publishing this information here for future reference.

If in the future I find some way to filter the IExplorerBrowser control, I will also post it here.

+2
source

I myself ran into this problem.

But I explored it a little further. IExplorerBrowser creates (on my Windows 7 x64 computer) a ExplorerBrowserControl class window. Which itself creates a window of the class DUIViewWndClassName . And the window itself ( DUIViewWndClassName ) is used as a control for the dialog created by IFileOpenDialog . Even window procedures are the same, so there are no subclasses (but I have not checked every subheading of this control).

And file dialogs can be filtered by file type even in library folders. Therefore, I believe that IExplorerBrowser (or the control that it uses) only allows Microsoft not to share knowledge on how to do this. Or, if so, then his somewhat hidden knowledge.

But I got it with IFolderFilterSite (the interface is supported by IExplorerBrowser from CLSID_ExplorerBrowser ). IFolderFilter::ShouldShow is not called for library folders in such cases. I was unable to call ICommDlgBrowser::IncludeObject (even if I did not set IFolderFilter ).


EDIT: I managed to call ICommDlgBrowser::IncludeObject . For some reason, I forgot that I should provide ICommDlgBrowser through IServiceProvider::QueryService , and not through IUnknown::QueryInterface . But still, ICommDlgBrowser::IncludeObject not called for library folders.

+1
source

I tried using IShellFolderViewDual3-> FilterView ().
But the search results.
Thanks.
IShellView * pShellView,
IDispatch * pDSFV,
IShellFolderViewDual3 * pSFVD3;

m_pExplorerBrowser-> GetCurrentView (IID_PPV_ARGS (& pShellView));
pShellView-> GetItemObject (SVGIO_BACKGROUND, IID_PPV_ARGS (& pDSFV))

pDSFV-> QueryInterface (IID_PPV_ARGS (& pSFVD3));
pSFVD3-> FilterView (bstrVal);

-one
source

All Articles