Subclass Windows File Explorer

117 views Asked by At

In my software I use File and Folder dialogue pickers. These pickers allow the specification of file type filters, so I can say, show only xml files. That works well.

I have a need to drill into some xml files and show only those that are valid for a schema. So I want to show user just those xml files of a certain type.

I don't want to write device driver code. I was wondering it some kind of subclassing of the Windows File explorer is possible. Is there some callback mechanism?

One idea maybe to use custom properties of the files, so a separate program could tag the xml files within a directory structure with a custom property. Then a dialog file picker could be instructed to look only for those files tagged as such. Perhaps other ways are possible.

1

There are 1 answers

1
Denis Anisimov On BEST ANSWER

When you call GetOpenFileName set OFN_ENABLEHOOK flag. It allows you to get notifications from open dialog. One of notifications is CDN_INCLUDEITEM. Inside your handler you will have IShellFolder of folder and PItemIDList of current file to insert in file list. If your hook procedure returns zero, the dialog box excludes the item from the list of items. To include the item, return a nonzero value from the hook procedure.