diff --git a/common/rawaccel-version.h b/common/rawaccel-version.h index 70029196..40ff2d2f 100644 --- a/common/rawaccel-version.h +++ b/common/rawaccel-version.h @@ -2,7 +2,7 @@ #define RA_VER_MAJOR 1 #define RA_VER_MINOR 4 -#define RA_VER_PATCH 2 +#define RA_VER_PATCH 3 #define RA_OS "Win7+" diff --git a/grapher/Form1.cs b/grapher/Form1.cs index 6927211b..51f1355e 100644 --- a/grapher/Form1.cs +++ b/grapher/Form1.cs @@ -176,13 +176,16 @@ public RawAcceleration() protected override void WndProc(ref Message m) { - if (m.Msg == 0x00ff) // WM_INPUT + if (!(AccelGUI is null)) { - AccelGUI.MouseWatcher.ReadMouseMove(m); - } - else if (m.Msg == 0x00fe) // WM_INPUT_DEVICE_CHANGE - { - AccelGUI.UpdateInputManagers(); + if (m.Msg == 0x00ff) // WM_INPUT + { + AccelGUI.MouseWatcher.ReadMouseMove(m); + } + else if (m.Msg == 0x00fe) // WM_INPUT_DEVICE_CHANGE + { + AccelGUI.UpdateInputManagers(); + } } base.WndProc(ref m); diff --git a/grapher/Program.cs b/grapher/Program.cs index 485e0747..894d1cd9 100644 --- a/grapher/Program.cs +++ b/grapher/Program.cs @@ -19,11 +19,20 @@ static void Main() return; } + AppDomain.CurrentDomain.UnhandledException += GlobalUnhandledExceptionHandler; + Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.Run(new RawAcceleration()); - - GC.KeepAlive(mutex); + + GC.KeepAlive(mutex); + } + + static void GlobalUnhandledExceptionHandler(object sender, UnhandledExceptionEventArgs e) + { + var ex = (Exception)e.ExceptionObject; + System.IO.File.WriteAllText("error.log", ex.ToString()); + MessageBox.Show(ex.Message, "Error"); } } }