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;
|
||||
|
||||
ApplicationDisplayMetrics curDisplayMetrics;
|
||||
ApplicationDisplayMetrics prevDisplayMetrics;
|
||||
ApplicationDisplayMetrics prevDisplayMetrics = null;
|
||||
if (!IsWindowMoved(displayKey, hWnd, 0, lastCaptureTime, out curDisplayMetrics, out prevDisplayMetrics))
|
||||
continue;
|
||||
if (prevDisplayMetrics == null)
|
||||
continue;
|
||||
|
||||
if (User32.IsHungAppWindow(hWnd) && !IsTaskBar(hWnd))
|
||||
{
|
||||
|
|
|
@ -17,7 +17,6 @@ namespace PersistentWindows.SystrayShell
|
|||
{
|
||||
messageLoop = new Thread(() =>
|
||||
{
|
||||
hkwin = new HotKeyWindow(hotkey);
|
||||
HotKeyForm hkf = new HotKeyForm(hotkey);
|
||||
Application.Run(hkf);
|
||||
})
|
||||
|
@ -30,13 +29,22 @@ namespace PersistentWindows.SystrayShell
|
|||
}
|
||||
|
||||
public static void Stop()
|
||||
{
|
||||
try
|
||||
{
|
||||
if (messageLoop.IsAlive)
|
||||
messageLoop.Abort();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Log.Error(ex.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
public HotKeyForm(uint hotkey)
|
||||
{
|
||||
hkwin = new HotKeyWindow(hotkey);
|
||||
|
||||
//InitializeComponent();
|
||||
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;
|
||||
|
||||
Application.Run();
|
||||
|
||||
if (hotkey_window)
|
||||
HotKeyForm.Stop();
|
||||
}
|
||||
|
||||
static bool WaitTaskbarReady()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue