Windows 10 1809 disappearing window mitigation details
2018-10-24 14:54:50
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():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():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.