Skip to main content
Topic: Windows 10 1809 disappearing window mitigation details (Read 759 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

Windows 10 1809 disappearing window mitigation details

Here I'm posting my findings about the Windows 10 1809 disappearing window bug, in hope that other software developers - fb2k component makers in particular- will find them useful.

At first it seemed like having multiple levels of popup windows, one a parent of another, is what triggers the bug. However some fb2k dialogs seemingly act the same way and yet do not suffer from this. I'm still investigating the details.

The exact workaround I came up with is based on passing the active window status to another window (a parent window) prior to the call to DestroyWindow():
Code: [Select]
if ( ::GetActiveWindow() == m_hWnd ) {
  HWND wndParent = ::GetParent(m_hWnd);
  if (wndParent != NULL) ::SetActiveWindow(wndParent);
}
::DestroyWindow(m_hWnd);

Adapt the above to ATL etc if necessary.

The above workaround has been applied to threaded_process dialogs in foobar2000 v1.4.1 beta 5, which hopefully covers most scenarios.

It is also a common scenario that a progress dialog (fb2k threaded_process API) is still exists while you receive a notification of its completion, and call DestroyWindow() from inside. That's fine by me, but Windows 10 1809 seems to disagree. In such case, you will also need to check if your window is the parent of the current active window when resigning its active status, as the progress dialog will not be doing its own DestroyWindow():

Code: [Select]
HWND wndActive = ::GetActiveWindow();
if ( wndActive == m_hWnd || ::GetParent(wndActive) == m_hWnd )
  HWND wndParent = ::GetParent(m_hWnd);
  if (wndParent != NULL) ::SetActiveWindow(wndParent);
}
::DestroyWindow(m_hWnd);

Other known mitigations:
Use main fb2k window (core_api::get_main_window()) for the parent your progress popups - ugly, allows progress dialog to be brought in front of your dialog that created it, or to outlive your dialog.
Avoid spawning multiple popup dialogs per task, display task progress in the dialog that was used to set the task up.

Re: Windows 10 1809 disappearing window mitigation details

Reply #1
Even on older version of Windows, for me and prior to 1.4.1 beta 5, applying changes in the Properties dialog caused the foobar2000 main window to be activated once the progress dialog disappeared (instead of activating the Properties window again). Which is obviously less annoying than the behaviour in Windows 10 1809, but perhaps it's another clue or an indication that something was always not quite right.
.

 
SimplePortal 1.0.0 RC1 © 2008-2018