Skip to content

Commit

Permalink
As DS_SETFOREGROUND doesn't work, move error reporter in/out of topmost
Browse files Browse the repository at this point in the history
* This will guarantee the window is brought to the front, but it won't
  keep it there and be annoying.
  • Loading branch information
baldurk committed Aug 1, 2016
1 parent a04379b commit 8b5f3de
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion renderdoccmd/renderdoccmd_win32.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,18 @@ INT_PTR CALLBACK CrashHandlerProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM

CheckDlgButton(hDlg, IDC_SENDDUMP, BST_CHECKED);
CheckDlgButton(hDlg, IDC_SENDLOG, BST_CHECKED);

{
RECT r;
GetClientRect(hDlg, &r);

int xPos = (GetSystemMetrics(SM_CXSCREEN) - r.right) / 2;
int yPos = (GetSystemMetrics(SM_CYSCREEN) - r.bottom) / 2;

SetWindowPos(hDlg, HWND_TOPMOST, xPos, yPos, 0, 0, SWP_NOSIZE);
}

return (INT_PTR)TRUE;
}

case WM_SHOWWINDOW:
Expand All @@ -117,7 +129,7 @@ INT_PTR CALLBACK CrashHandlerProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM
int xPos = (GetSystemMetrics(SM_CXSCREEN) - r.right) / 2;
int yPos = (GetSystemMetrics(SM_CYSCREEN) - r.bottom) / 2;

SetWindowPos(hDlg, NULL, xPos, yPos, 0, 0, SWP_NOZORDER | SWP_NOSIZE);
SetWindowPos(hDlg, HWND_NOTOPMOST, xPos, yPos, 0, 0, SWP_NOSIZE);
}

return (INT_PTR)TRUE;
Expand Down

0 comments on commit 8b5f3de

Please sign in to comment.