Skip to content

Commit

Permalink
修复WorkerW窗口查找失败
Browse files Browse the repository at this point in the history
  • Loading branch information
ww-rm committed Dec 19, 2024
1 parent 9ab0eb5 commit a69f63f
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions TinyEngine/src/Win32.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
Expand Down Expand Up @@ -116,13 +117,8 @@ public static IntPtr GetWorkerW()
var progman = FindWindow("Progman", null);
if (progman == IntPtr.Zero)
return IntPtr.Zero;
IntPtr hWnd = IntPtr.Zero;
do
{
hWnd = FindWindowEx(IntPtr.Zero, hWnd, "WorkerW", null);
if (hWnd != IntPtr.Zero && GetWindow(hWnd, GW_OWNER) == progman)
break;
} while (hWnd != IntPtr.Zero);
IntPtr hWnd = FindWindowEx(progman, 0, "WorkerW", null);
Debug.WriteLine($"{hWnd:x8}");
return hWnd;
}
}
Expand Down

0 comments on commit a69f63f

Please sign in to comment.