mirror of
https://github.com/kangyu-california/PersistentWindows.git
synced 2025-05-11 13:05:38 +02:00
attempt to resolve crash when exit
This commit is contained in:
parent
406fed8328
commit
98dc78705c
3 changed files with 17 additions and 4 deletions
|
@ -3497,9 +3497,11 @@ namespace PersistentWindows.Common
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
ApplicationDisplayMetrics curDisplayMetrics;
|
ApplicationDisplayMetrics curDisplayMetrics;
|
||||||
ApplicationDisplayMetrics prevDisplayMetrics;
|
ApplicationDisplayMetrics prevDisplayMetrics = null;
|
||||||
if (!IsWindowMoved(displayKey, hWnd, 0, lastCaptureTime, out curDisplayMetrics, out prevDisplayMetrics))
|
if (!IsWindowMoved(displayKey, hWnd, 0, lastCaptureTime, out curDisplayMetrics, out prevDisplayMetrics))
|
||||||
continue;
|
continue;
|
||||||
|
if (prevDisplayMetrics == null)
|
||||||
|
continue;
|
||||||
|
|
||||||
if (User32.IsHungAppWindow(hWnd) && !IsTaskBar(hWnd))
|
if (User32.IsHungAppWindow(hWnd) && !IsTaskBar(hWnd))
|
||||||
{
|
{
|
||||||
|
|
|
@ -17,7 +17,6 @@ namespace PersistentWindows.SystrayShell
|
||||||
{
|
{
|
||||||
messageLoop = new Thread(() =>
|
messageLoop = new Thread(() =>
|
||||||
{
|
{
|
||||||
hkwin = new HotKeyWindow(hotkey);
|
|
||||||
HotKeyForm hkf = new HotKeyForm(hotkey);
|
HotKeyForm hkf = new HotKeyForm(hotkey);
|
||||||
Application.Run(hkf);
|
Application.Run(hkf);
|
||||||
})
|
})
|
||||||
|
@ -31,12 +30,21 @@ namespace PersistentWindows.SystrayShell
|
||||||
|
|
||||||
public static void Stop()
|
public static void Stop()
|
||||||
{
|
{
|
||||||
if (messageLoop.IsAlive)
|
try
|
||||||
messageLoop.Abort();
|
{
|
||||||
|
if (messageLoop.IsAlive)
|
||||||
|
messageLoop.Abort();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Log.Error(ex.ToString());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public HotKeyForm(uint hotkey)
|
public HotKeyForm(uint hotkey)
|
||||||
{
|
{
|
||||||
|
hkwin = new HotKeyWindow(hotkey);
|
||||||
|
|
||||||
//InitializeComponent();
|
//InitializeComponent();
|
||||||
var r = User32.RegisterHotKey(this.Handle, 0, (int)User32.KeyModifier.Alt, hotkey); // Register Alt + W
|
var r = User32.RegisterHotKey(this.Handle, 0, (int)User32.KeyModifier.Alt, hotkey); // Register Alt + W
|
||||||
}
|
}
|
||||||
|
|
|
@ -373,6 +373,9 @@ namespace PersistentWindows.SystrayShell
|
||||||
//systrayForm.notifyIconMain.Visible = false;
|
//systrayForm.notifyIconMain.Visible = false;
|
||||||
|
|
||||||
Application.Run();
|
Application.Run();
|
||||||
|
|
||||||
|
if (hotkey_window)
|
||||||
|
HotKeyForm.Stop();
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool WaitTaskbarReady()
|
static bool WaitTaskbarReady()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue