]> git.mxchange.org Git - flightgear.git/commitdiff
Avoid "no disk in drive" popups on Win7 systems
authorThorstenB <brehmt@gmail.com>
Sat, 20 Aug 2011 20:55:42 +0000 (22:55 +0200)
committerThorstenB <brehmt@gmail.com>
Sat, 20 Aug 2011 21:13:17 +0000 (23:13 +0200)
Stray accesses to exchangeable drives cause pop-up error boxes on
Win7 systems, blocking the entire process.

src/Main/bootstrap.cxx

index c29440dba8400b66af5eb8b8d8539219b81be7e8..2208ceb15502b16a735c8686cc6c2fc98db3c917 100644 (file)
 #  include <config.h>
 #endif
 
+#ifdef HAVE_WINDOWS_H
+#include <windows.h>
+#endif
+
 #if defined(HAVE_FEENABLEEXCEPT)
 #ifndef _GNU_SOURCE
 #define _GNU_SOURCE
@@ -167,6 +171,11 @@ int _bootstrap_OSInit;
 // Main entry point; catch any exceptions that have made it this far.
 int main ( int argc, char **argv ) {
 #if _MSC_VER
+  // Don't show blocking "no disk in drive" error messages on Windows 7,
+  // silently return errors to application instead.
+  // See Microsoft MSDN #ms680621: "GUI apps should specify SEM_NOOPENFILEERRORBOX"
+  SetErrorMode(SEM_NOOPENFILEERRORBOX);
+
   // Windows has no $HOME aka %HOME%, so we have to construct the full path.
   // make sure it fits into the buffer. Max. path length is 255, but who knows
   // what's in these environment variables?