diff options
author | Your Name <you@example.com> | 2019-01-17 02:34:13 +0900 |
---|---|---|
committer | Your Name <you@example.com> | 2019-01-17 02:34:13 +0900 |
commit | a8ff08420fbd160e9ddbc16b6f5b228c0d853467 (patch) | |
tree | 1575cea072f2820ef003e2319903c56d8a901327 | |
parent | 954dbe5c55e935521271eb74d152555188a0d225 (diff) | |
download | wf-clock-a8ff08420fbd160e9ddbc16b6f5b228c0d853467.tar.gz |
debugging....2019-01-16
-rw-r--r-- | WarframeClock/ClockOverlay.cs | 6 | ||||
-rw-r--r-- | WarframeClock/Program.cs | 19 |
2 files changed, 19 insertions, 6 deletions
diff --git a/WarframeClock/ClockOverlay.cs b/WarframeClock/ClockOverlay.cs index 4d873f7..acdd2f7 100644 --- a/WarframeClock/ClockOverlay.cs +++ b/WarframeClock/ClockOverlay.cs @@ -152,7 +152,11 @@ namespace WarframeClock } Native.Rect newBounds; - Native.GetWindowRect(targetWindowHandle, out newBounds); + if (Native.GetWindowRect(targetWindowHandle, out newBounds) == 0) + { + targetWindowHandle = IntPtr.Zero; + return; + } if (parentBounds.Left != newBounds.Left || parentBounds.Right != newBounds.Right || parentBounds.Top != newBounds.Top || parentBounds.Bottom != newBounds.Bottom) { diff --git a/WarframeClock/Program.cs b/WarframeClock/Program.cs index 71514cb..6378173 100644 --- a/WarframeClock/Program.cs +++ b/WarframeClock/Program.cs @@ -15,12 +15,21 @@ namespace WarframeClock [STAThread] static void Main(string[] args) { - clock = new Clock(); + try + { + clock = new Clock(); - StartNotifyIcon(); - if (UseWorldStatePhp) - StartWorldStateFetch(); - StartOverlay(); + StartNotifyIcon(); + if (UseWorldStatePhp) + StartWorldStateFetch(); + StartOverlay(); + } + catch (Exception ex) + { + Console.WriteLine($"Main: Uncaught exception: {ex.Message}"); + Console.WriteLine(ex.StackTrace); + MessageBox.Show($"Main: Uncaught exception: {ex.Message}\n{ex.StackTrace}"); + } } private static void StartNotifyIcon() |