From bd67c18c022f6a01ba054ecd77ba176359f33f73 Mon Sep 17 00:00:00 2001 From: jp9000 Date: Fri, 23 Dec 2016 01:53:44 -0800 Subject: [PATCH] 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. --- plugins/win-capture/window-helpers.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/plugins/win-capture/window-helpers.c b/plugins/win-capture/window-helpers.c index 6c2e5d8f1..2c90d7542 100644 --- a/plugins/win-capture/window-helpers.c +++ b/plugins/win-capture/window-helpers.c @@ -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;