diff --git a/d3d9/IDirect3D9Ex.cpp b/d3d9/IDirect3D9Ex.cpp index 8fcae691..4392025a 100644 --- a/d3d9/IDirect3D9Ex.cpp +++ b/d3d9/IDirect3D9Ex.cpp @@ -510,16 +510,23 @@ void UpdatePresentParameter(D3DPRESENT_PARAMETERS* pPresentationParameters, HWND if (IsIconic(DeviceDetails.DeviceWindow)) { ShowWindow(DeviceDetails.DeviceWindow, SW_RESTORE); - - // Peek messages to help prevent a "Not Responding" window - Utils::CheckMessageQueue(DeviceDetails.DeviceWindow); } // Remove tool and topmost window if (DeviceDetails.DeviceWindow != LastDeviceWindow) { + LONG lStyle = GetWindowLong(DeviceDetails.DeviceWindow, GWL_STYLE); LONG lExStyle = GetWindowLong(DeviceDetails.DeviceWindow, GWL_EXSTYLE); + if (!(lStyle & WS_VISIBLE)) + { + LOG_LIMIT(3, __FUNCTION__ << " Adding window WS_VISIBLE"); + + SetWindowLong(DeviceDetails.DeviceWindow, GWL_STYLE, lStyle | WS_VISIBLE); + SetWindowPos(DeviceDetails.DeviceWindow, ((lExStyle & WS_EX_TOPMOST) ? HWND_TOPMOST : HWND_TOP), + 0, 0, 0, 0, SWP_NOZORDER | SWP_NOMOVE | SWP_NOSIZE | SWP_FRAMECHANGED); + } + if (lExStyle & (WS_EX_TOOLWINDOW | WS_EX_TOPMOST)) { LOG_LIMIT(3, __FUNCTION__ << " Removing window" << ((lExStyle & WS_EX_TOOLWINDOW) ? " WS_EX_TOOLWINDOW" : "") << ((lExStyle & WS_EX_TOPMOST) ? " WS_EX_TOPMOST" : "")); @@ -545,12 +552,6 @@ void UpdatePresentParameter(D3DPRESENT_PARAMETERS* pPresentationParameters, HWND { bool AnyChange = (LastBufferWidth != DeviceDetails.BufferWidth || LastBufferHeight != DeviceDetails.BufferHeight || LastDeviceWindow != DeviceDetails.DeviceWindow); - // Overload WndProc - if (Config.EnableWindowMode) - { - Utils::SetWndProcFilter(DeviceDetails.DeviceWindow); - } - // Adjust window RECT Rect; GetClientRect(DeviceDetails.DeviceWindow, &Rect); @@ -578,15 +579,6 @@ void UpdatePresentParameter(D3DPRESENT_PARAMETERS* pPresentationParameters, HWND ChangeDisplaySettingsEx(bRet ? infoex.szDevice : nullptr, &newSettings, nullptr, CDS_FULLSCREEN, nullptr); } } - - if (Config.EnableWindowMode) - { - // Resetting WndProc - Utils::RestoreWndProcFilter(DeviceDetails.DeviceWindow); - - // Peek messages to help prevent a "Not Responding" window - Utils::CheckMessageQueue(DeviceDetails.DeviceWindow); - } } }