From c96ddd9ee553b89bdd0073d273312d40771006bd Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Mon, 23 May 2016 09:41:06 +0200 Subject: QWindowsTheme: Suppress error dialogs when calling SHGetFileInfo(). Set the error mode flag SEM_NOOPENFILEERRORBOX when calling Win32 API SHGetFileInfo() to prevent it from prompting to insert media as does QStorageInfoPrivate::mountedVolumes(). Task-number: QTBUG-32457 Task-number: QTBUG-48823 Change-Id: I01a2f99b5a75b39dd729509ca319f634e3dcd695 Reviewed-by: Maurice Kalinowski --- src/plugins/platforms/windows/qwindowstheme.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'src/plugins/platforms/windows/qwindowstheme.cpp') diff --git a/src/plugins/platforms/windows/qwindowstheme.cpp b/src/plugins/platforms/windows/qwindowstheme.cpp index 4a13f646f2..f673ce5c25 100644 --- a/src/plugins/platforms/windows/qwindowstheme.cpp +++ b/src/plugins/platforms/windows/qwindowstheme.cpp @@ -132,7 +132,16 @@ public: explicit ShGetFileInfoFunction(const wchar_t *fn, DWORD a, SHFILEINFO *i, UINT f, bool *r) : m_fileName(fn), m_attributes(a), m_flags(f), m_info(i), m_result(r) {} - void operator()() const { *m_result = SHGetFileInfo(m_fileName, m_attributes, m_info, sizeof(SHFILEINFO), m_flags); } + void operator()() const + { +#ifndef Q_OS_WINCE + const UINT oldErrorMode = SetErrorMode(SEM_FAILCRITICALERRORS | SEM_NOOPENFILEERRORBOX); +#endif + *m_result = SHGetFileInfo(m_fileName, m_attributes, m_info, sizeof(SHFILEINFO), m_flags); +#ifndef Q_OS_WINCE + SetErrorMode(oldErrorMode); +#endif + } private: const wchar_t *m_fileName; -- cgit v1.2.3