obs-studio/plugins/win-capture/window-helpers.h
jp9000 1e48b522fa win-capture: Fix getting proper UWP window handles
The "main" windows detected for UWP programs are basically to help
sandbox the programs -- they run in the ApplicationFrameHost process and
help reduce the possibility of other programs trying to access the
actual process window, which is a child window.

To bypass this, go through the list of child windows for the
ApplicationFrameHost window, and then find the one that's attached to
a different process; that different process will always be the target,
and will allows us to open the actual process of the UWP program.
2016-12-16 02:21:05 -08:00

38 lines
914 B
C

#pragma once
#include <util/dstr.h>
enum window_priority {
WINDOW_PRIORITY_CLASS,
WINDOW_PRIORITY_TITLE,
WINDOW_PRIORITY_EXE,
};
enum window_search_mode {
INCLUDE_MINIMIZED,
EXCLUDE_MINIMIZED
};
extern bool get_window_exe(struct dstr *name, HWND window);
extern void get_window_title(struct dstr *name, HWND hwnd);
extern void get_window_class(struct dstr *class, HWND hwnd);
extern bool is_uwp_window(HWND hwnd);
extern HWND get_uwp_actual_window(HWND parent);
typedef bool (*add_window_cb)(const char *title, const char *class,
const char *exe);
extern void fill_window_list(obs_property_t *p, enum window_search_mode mode,
add_window_cb callback);
extern void build_window_strings(const char *str,
char **class,
char **title,
char **exe);
extern HWND find_window(enum window_search_mode mode,
enum window_priority priority,
const char *class,
const char *title,
const char *exe);