Is there a way to choose which files are displayed to the user via the standard OPENFILE dialogs?

后端 未结 2 465
迷失自我
迷失自我 2020-12-21 07:13

Vista introduced an interface: IFileDialog::SetFilter, which allows me to setup a filter that will be called for every potential filename to see if it should be shown to the

相关标签:
2条回答
  • 2020-12-21 07:54

    You need to initialise the callbacks for your CFileDialog. Then you need to process CDN_INCLUDEITEM notification code to include or exclude items.

    You can also check this great article. The author uses some other approaches in addition to callbacks

    0 讨论(0)
  • 2020-12-21 07:56

    As you have already discovered, starting in Windows 7 it is no longer possible to filter out files from being displayed based on content, only file extension. You can, however, validate that the user's selected file(s) are acceptable to you before allowing the dialog to close, and if they are not then display a message box to the user and keep the dialog open. That is the best you will be able to do unless you create your own custom dialog.

    0 讨论(0)
提交回复
热议问题