Skip to content

Commit

Permalink
Disable CheckMessageQueue() and SetWndProcFilter()
Browse files Browse the repository at this point in the history
  • Loading branch information
elishacloud committed Aug 24, 2024
1 parent 1f22bb9 commit 9aaa6c5
Showing 1 changed file with 10 additions and 18 deletions.
28 changes: 10 additions & 18 deletions d3d9/IDirect3D9Ex.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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" : ""));
Expand All @@ -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);
Expand Down Expand Up @@ -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);
}
}
}

Expand Down

0 comments on commit 9aaa6c5

Please sign in to comment.