mirror of
https://github.com/kangyu-california/PersistentWindows.git
synced 2025-05-11 04:55:39 +02:00
catch exception in resolving window handle collision
This commit is contained in:
parent
c47246cc65
commit
a541eb0a6c
1 changed files with 18 additions and 10 deletions
|
@ -1168,6 +1168,20 @@ namespace PersistentWindows.Common
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ResolveWindowHandleCollision(IntPtr hwnd)
|
private void ResolveWindowHandleCollision(IntPtr hwnd)
|
||||||
|
{
|
||||||
|
if (resolveHwndConflict)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
ResolveWindowHandleCollisionCore(hwnd);
|
||||||
|
} catch (Exception ex)
|
||||||
|
{
|
||||||
|
Log.Error(ex.ToString());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ResolveWindowHandleCollisionCore(IntPtr hwnd)
|
||||||
{
|
{
|
||||||
bool found_conflict = false;
|
bool found_conflict = false;
|
||||||
string process_name = "";
|
string process_name = "";
|
||||||
|
@ -2924,22 +2938,16 @@ namespace PersistentWindows.Common
|
||||||
IntPtr kid = FindMatchingKilledWindow(hwnd);
|
IntPtr kid = FindMatchingKilledWindow(hwnd);
|
||||||
if (kid == IntPtr.Zero)
|
if (kid == IntPtr.Zero)
|
||||||
{
|
{
|
||||||
if (resolveHwndConflict)
|
ResolveWindowHandleCollision(hwnd);
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
ResolveWindowHandleCollision(hwnd);
|
|
||||||
} catch (Exception ex)
|
|
||||||
{
|
|
||||||
Log.Error(ex.ToString());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
InheritKilledWindow(hwnd, kid);
|
InheritKilledWindow(hwnd, kid);
|
||||||
if (hwnd != kid)
|
if (hwnd != kid)
|
||||||
|
{
|
||||||
Log.Error($"Inherit position data from killed window 0x{kid.ToString("X")} for {curDisplayMetrics.Title}");
|
Log.Error($"Inherit position data from killed window 0x{kid.ToString("X")} for {curDisplayMetrics.Title}");
|
||||||
|
ResolveWindowHandleCollision(hwnd);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
Log.Error($"Inherit position data from existing window 0x{kid.ToString("X")} for {curDisplayMetrics.Title}");
|
Log.Error($"Inherit position data from existing window 0x{kid.ToString("X")} for {curDisplayMetrics.Title}");
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue