diff options
| author | a1xd <[email protected]> | 2021-03-11 07:00:19 -0500 |
|---|---|---|
| committer | GitHub <[email protected]> | 2021-03-11 07:00:19 -0500 |
| commit | 11b62cfcf58dbf9b0e5328f2bf283864185e95be (patch) | |
| tree | 1d401f7d99570cb0e560944af52167060295bf8b | |
| parent | Merge pull request #71 from a1xd/fix-dev-id (diff) | |
| parent | add handler for unhandled exceptions (diff) | |
| download | rawaccel-11b62cfcf58dbf9b0e5328f2bf283864185e95be.tar.xz rawaccel-11b62cfcf58dbf9b0e5328f2bf283864185e95be.zip | |
Merge pull request #81 from a1xd/log-unhandled-exv1.4.3
add handler for unhandled exceptions
| -rw-r--r-- | common/rawaccel-version.h | 2 | ||||
| -rw-r--r-- | grapher/Form1.cs | 15 | ||||
| -rw-r--r-- | grapher/Program.cs | 13 |
3 files changed, 21 insertions, 9 deletions
diff --git a/common/rawaccel-version.h b/common/rawaccel-version.h index 7002919..40ff2d2 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 6927211..51f1355 100644 --- a/grapher/Form1.cs +++ b/grapher/Form1.cs @@ -176,13 +176,16 @@ namespace grapher 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 485e074..894d1cd 100644 --- a/grapher/Program.cs +++ b/grapher/Program.cs @@ -19,11 +19,20 @@ namespace grapher 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"); } } } |