There's no way to achieve what you want. The system file dialog does not allow you to filter the files that it displays based on their content.
The OnIncludeItem
event tantalisingly appears to do what you need. However, it has the following problems.
- The event wraps the
CDN_INCLUDEITEM
notification. This notification is fired by the legacy XP common dialog boxes, but not by the modern common item dialog. So, using the event forces the legacy XP common dialog boxes onto your program. If for no other reason, this has cosmetic downsides. - More significantly, handling
CDN_INCLUDEITEM
has no impact on files. It only influences non-filesystem shell objects. Form the documentation:
The dialog box always includes items that have both the SFGAO_FILESYSTEM and SFGAO_FILESYSANCESTOR attributes, regardless of the value returned by CDN_INCLUDEITEM.
Related questions: