On new Windows versions (it is so at least on Windows 7 but I have reasons to believe it happens on Vista to) IFileDialog
(and thus IFileOpenDialog
and IFileSaveDialog
) automatically append the wildcard pattern to the file type description if they find none.
This is a nice feature to make usage easier while enhancing consistency and enforcement of guidelines. But sometimes it is not desired. If accepted extensions are numerous (like "All Images") then corresponding combobox entry is way too long. The worst thing is that this is not even documented and I only found a note about it (confirming my observations) at CodeProject article.
On Windows 7 the backward compatibility checking (as mentioned by CodeProject article) is not so strong and it seems any patterns manually appended to description will prevent automatic appending. This was already pointed out by an answer to another question. Yet this solution is far from ideal. (I decided to ask the same question again as I believe the previous one was poorly tagged and described: (1) I found it first by looking at similar questions suggested by StackOverflow, my previous queries in Google didn't found it and (2) the issue is general and not limited to Delphi.)
How to prevent this?
Note that I have to use IFileDialog
because I need the customizations it offers. (So switching to dialog produced by GetOpenFileName
and GetSaveFileName
is not an option.)