From c32996a57d27b7b4a56a19ff26ac78ca4fd30cb6 Mon Sep 17 00:00:00 2001 From: Martchus Date: Sun, 7 Apr 2024 21:15:55 +0200 Subject: [PATCH] Show error reporting UI for process under Windows --- resources/resources.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/resources/resources.cpp b/resources/resources.cpp index ae41807..998292f 100644 --- a/resources/resources.cpp +++ b/resources/resources.cpp @@ -20,6 +20,11 @@ #include #endif +#ifdef Q_OS_WINDOWS +#include +#include +#endif + #include using namespace std; @@ -356,6 +361,14 @@ void setupCommonQtApplicationAttributes() } QCoreApplication::setAttribute(Qt::AA_UseHighDpiPixmaps, true); #endif + + // always show error reporting UI for this process (applicable for interactive applications only) + // see https://learn.microsoft.com/en-us/windows/win32/api/werapi/nf-werapi-wersetflags +#ifdef Q_OS_WINDOWS + if (WerSetFlags(WER_FAULT_REPORTING_ALWAYS_SHOW_UI) != S_OK) { + std::cerr << "Unable to initialize error reporting.\n"; + } +#endif } /*!