If a file extension is known how do you convert the extension to a FileTypeIndex in the TFileSaveDialog DoExecute event?
function TIEWin7FileSaveDialog.DoExecute: Bool;
begin
...
{Set FileType (filter) index}
iWideTextension := ExtractFileExt(FileName);
FileTypeIndex := ???ExtensionToFileTypeIndex(iWideExtension);???
FileDialog.SetFileTypeIndex(FileTypeIndex);
...
end;
There’s no explicit function that would do what you want at least since one file type may be contained in more file type masks, so you can only iterate the
FileTypesand check if the file type is contained or equals to theFileMasklike shown below:And the usage (note that the input must match exactly to the filter mask):