none
Incorrect result of IFileDialog::GetCurrentSelection() RRS feed

  • Question

  • # Summary:
    Incorrect result of IFileDialog::GetCurrentSelection()

    # Description:
    I have a file browser dialog that is using Windows IFileDialog and IFileDialogCustomize for custom controls. I have added an action button to the file browser dialog using IFileDialogCustomize::AddPushButton(). I wish to enable/disable an action button on the basis of currently selected file (or file type). To fetch the currently selected item in the browser, I am using IFileDialog::GetCurrentSelection(). I would like to report an issue that I get when GetCurrentSelection() is used after a folder change.

    I am overriding IFileDialogEvents::OnSelectionChange() to fetch the currently selected item using GetDisplayName(SIGDN_FILESYSPATH, &pwsz) on the IShellItem object.

    # Steps:
    1) Launch a file browser. 
    2) Select a file from dialog. At this point GetCurrentSelection() gives the correct result.
    3) Now navigate to a folder. After the dialog has switched to the new folder GetCurrentSelection() still gives the previously selected shell item. 
    Thursday, February 13, 2020 5:20 AM