Odd behaviour of the Windows native filechooser dialog (and other native dialogs)

There are a few issues with the Windows file chooser dialog. All of this can be reproduced by the Juce demo app. Perhaps related to the Calloutbox issue.

  • The dialog appears in the task bar, and the alt-tab windows switcher as a separate top level window
  • unlike every other dialog box, this one doesn’t get the focus if you try to click on the main window. The standard behaviour of Windows (flickering the window border) also doesn’t work.
  • Alt-tab is broken: If you try to focus on the main window, no window gets the focus.

If you try with the other native popup dialogs, the issue is worse. Not only does the focus not work, but if the dialog is hidden behind another window, it won’t pop up, making it appear like your app just hangs.

Not sure why that is (in the debugger everything looks OK). My guess it’s the trick with the parentWindow component — normally of.hwndOwner would be initialized with the HWND of the main window.