Windows IFileOpenDialog GetCurrentSelection sometimes return the wrong value
See the question and my original answer on StackOverflowThis is not a bug. The Shell GUI shown in Explorer (and partially in Common Dialogs) is more or less organized like this:
The IFileDialogEvents logic is the following:
OnSelectionChange
is triggered by the "Folder View" (usually visible as a list of items and folders) and you can useIFileDialog::GetCurrentSelection()
when it's triggered.OnFolderChange
is triggered by the "Tree View" and you can useIFileDialog::GetFolder()
when it's triggered.
So, we can't trust GetCurrentSelection()
in the OnFolderChange
event.