# FileChooser not appearing in Windows

**URL:** <https://forum.juce.com/t/filechooser-not-appearing-in-windows/54952>\
**Category:** General JUCE discussion\
**Created:** [February 11, 2023, 12:15pm UTC](https://forum.juce.com/t/filechooser-not-appearing-in-windows/54952 "2023-02-11T12:15:08Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![leehu](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/leehu/32/3280_2.png) [@leehu](https://forum.juce.com/u/leehu)\
**Post date:** [February 11, 2023, 12:15pm UTC](https://forum.juce.com/t/filechooser-not-appearing-in-windows/54952/1 "2023-02-11T12:15:08Z")

</div>

Hi, anyone got any ideas why this code doesn’t pop up a file chooser?

```
auto *p_fc = new FileChooser( "Save Favourites", juce::File(), "*" );

p_fc->launchAsync(juce::FileBrowserComponent::saveMode | juce::FileBrowserComponent::canSelectDirectories,
                        [=](const juce::FileChooser &fileChooser) {
    const auto path = fileChooser.getResults()[0];
    
    DBG( "export_favourites: " << path.getFullPathName() );
} );

```

Works fine on Mac and I have similar code in other projects, but in this app no window appears and the callback is executed immediately.

thx

---

<div class="post-metadata">

**Author:** ![reuk](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/reuk/32/21494_2.png) [@reuk](https://forum.juce.com/u/reuk)\
**Post date:** [February 11, 2023, 3:38pm UTC](https://forum.juce.com/t/filechooser-not-appearing-in-windows/54952/2 "2023-02-11T15:38:45Z")

</div>

Perhaps this commit introduced a regression:

> <https://github.com/juce-framework/JUCE/commit/f5aa881b6f2d7b13fd758b98bec660b592ee3021>
>
> The previous method for finding the dialog's owner was ineffective, and
> it was s…till possible for other windows to obscure the file picker in
> many cases. Using GetActiveWindow seems to produce the expected
> behaviour.

Are you using this commit? If so, please let us know the Windows version, plugin format, plugin host, and any other information that might be necessary to reproduce the problem.

If you’re not using this commit, please try updating and see whether the issue persists on develop.

---

<div class="post-metadata">

**Author:** ![Verbonaut](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/verbonaut/32/11824_2.png) [@Verbonaut](https://forum.juce.com/u/Verbonaut)\
**Post date:** [February 11, 2023, 5:10pm UTC](https://forum.juce.com/t/filechooser-not-appearing-in-windows/54952/3 "2023-02-11T17:10:04Z")

</div>

Is p\_fc going out of scope too quickly and closing the chooser when it is destructed? Hard to know without a bit more of the context around that code.

---

<div class="post-metadata">

**Author:** ![leehu](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/leehu/32/3280_2.png) [@leehu](https://forum.juce.com/u/leehu)\
**Post date:** [February 11, 2023, 7:24pm UTC](https://forum.juce.com/t/filechooser-not-appearing-in-windows/54952/4 "2023-02-11T19:24:24Z")

</div>

Hi, thx.

The chooser appears if I remove the

juce::FileBrowserComponent::canSelectDirectories

from the options passed. Not sure if I actually need this, but maybe this should assert in debug so that callers know it’s an issue, or, the chooser should appear.

At any rate, I guess Windows and Mac should have the same behaviour.

thx
