Link to home
Start Free TrialLog in
Avatar of apostrophe27
apostrophe27

asked on

Filter file types in CMFCShellListCtrl


I'm working with the new MFC control CMFCShellListCtrl and I'm trying to add filters to the view. I want to filter by file type or string. Since it's new, the documentation and examples are limited.

So how to I set up filters?

Thanks

SOLUTION
Avatar of Deepu Abraham
Deepu Abraham
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of apostrophe27
apostrophe27

ASKER


I don't fully understand your code, but it looks like it retrieves the information on a file. Is that correct?

What I want to do is have the explorer window in the list control display only a certain type of file, .txt for example, or a string.  How do I use your example to do that?

Thanks.
This question really is hanging about isn't it!  

I have had a good look around and come up with next to nothing for this one...the only thing I can suggest is taking a look at

http://www.codeproject.com/Messages/3206089/How-to-use-the-CMFCShellListCtrl-Class.aspx

Here, the author here claims to have found a "callback" function that will be called every time an item is added: if this is the case, you need to override that to filter out the file types you don't want to show.  However, he claims it does not work, but he might be doing something slightly wrong; maybe your eyes can see what is incorrect with it.  I don't have VS 2010 installed so I cannot try this.

Sorry if this is of no use: if you still can find no answers I might have to install VS 2010 and nail this myself :)
PS, I take it you have looked at the MFC 10 "Explorer" sample: http://msdn.microsoft.com/en-us/library/bb982182.aspx ?

Sorry it's been awhile. I got stuck working on other things.

I saw the code project post, and I didn't understand what he was doing. Since it didn't work for him I didn't pursue it.

I saw the Explorer sample too, but it doesn't show any filtering.

I just saw a post at:
http://social.msdn.microsoft.com/Forums/en-GB/windowssdk/thread/794521ed-66e2-494f-ab28-75100fdf58d1 

They're talking about creating and open file dialog box

" You can create a dialog and add a CMFCShellListCtrl-derived control to it. There is an undocumented EnumObjects function you can override to filter the results. "

I'm not sure if that's useful or not

Yeah, EnumObjects() was mentioned in the first post by DeepuAbrahamK: did you not try his code??
Right, he did mention EnumObjects(). Sorry, I didn't catch that when I reread the thread.

I didn't try his code because I didn't understand how to use it. I did him how to use it, but I got no response.

SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
No problem.  Thanks for splitting the points.

At some point I will install VS 2010 and see if I can figure this out; when I do (note the confidence - *when*, not *if* :) ) I will let you know.
I haven't gotten this to work, and I've moved on to other things.