mirror of
https://github.com/kangyu-california/PersistentWindows.git
synced 2025-05-10 20:45:38 +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)
|
||||
{
|
||||
if (resolveHwndConflict)
|
||||
{
|
||||
try
|
||||
{
|
||||
ResolveWindowHandleCollisionCore(hwnd);
|
||||
} catch (Exception ex)
|
||||
{
|
||||
Log.Error(ex.ToString());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void ResolveWindowHandleCollisionCore(IntPtr hwnd)
|
||||
{
|
||||
bool found_conflict = false;
|
||||
string process_name = "";
|
||||
|
@ -2924,22 +2938,16 @@ namespace PersistentWindows.Common
|
|||
IntPtr kid = FindMatchingKilledWindow(hwnd);
|
||||
if (kid == IntPtr.Zero)
|
||||
{
|
||||
if (resolveHwndConflict)
|
||||
{
|
||||
try
|
||||
{
|
||||
ResolveWindowHandleCollision(hwnd);
|
||||
} catch (Exception ex)
|
||||
{
|
||||
Log.Error(ex.ToString());
|
||||
}
|
||||
}
|
||||
ResolveWindowHandleCollision(hwnd);
|
||||
}
|
||||
else
|
||||
{
|
||||
InheritKilledWindow(hwnd, kid);
|
||||
if (hwnd != kid)
|
||||
{
|
||||
Log.Error($"Inherit position data from killed window 0x{kid.ToString("X")} for {curDisplayMetrics.Title}");
|
||||
ResolveWindowHandleCollision(hwnd);
|
||||
}
|
||||
else
|
||||
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