win-capture: Use FindWindowEx to traverse window list
For some unknown reason, GetWindow will not traverse the entire window tree. It could be due to Microsoft purposely hiding certain UWP windows, though the reason is unknown. For some equally unknown reason FindWindowEx does work in its place. This fixes the issue of not being able to find/capture certain windows, such as halo 5: forge.
This commit is contained in:
parent
3b5a30ce97
commit
bd67c18c02
@ -209,7 +209,7 @@ HWND get_uwp_actual_window(HWND parent)
|
||||
HWND child;
|
||||
|
||||
GetWindowThreadProcessId(parent, &parent_id);
|
||||
child = GetWindow(parent, GW_CHILD);
|
||||
child = FindWindowEx(parent, NULL, NULL, NULL);
|
||||
|
||||
while (child) {
|
||||
DWORD child_id = 0;
|
||||
@ -218,7 +218,7 @@ HWND get_uwp_actual_window(HWND parent)
|
||||
if (child_id != parent_id)
|
||||
return child;
|
||||
|
||||
child = GetNextWindow(child, GW_HWNDNEXT);
|
||||
child = FindWindowEx(parent, child, NULL, NULL);
|
||||
}
|
||||
|
||||
return NULL;
|
||||
@ -233,7 +233,7 @@ static inline HWND next_window(HWND window, enum window_search_mode mode,
|
||||
}
|
||||
|
||||
while (true) {
|
||||
window = GetNextWindow(window, GW_HWNDNEXT);
|
||||
window = FindWindowEx(GetDesktopWindow(), window, NULL, NULL);
|
||||
if (!window || check_window_valid(window, mode))
|
||||
break;
|
||||
}
|
||||
@ -251,7 +251,7 @@ static inline HWND next_window(HWND window, enum window_search_mode mode,
|
||||
|
||||
static inline HWND first_window(enum window_search_mode mode, HWND *parent)
|
||||
{
|
||||
HWND window = GetWindow(GetDesktopWindow(), GW_CHILD);
|
||||
HWND window = FindWindowEx(GetDesktopWindow(), NULL, NULL, NULL);
|
||||
|
||||
*parent = NULL;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user