I am monitoring the current foreground process using SetWinEventHook() and EVENT_SYSTEM_FOREGROUND, which gives me the HWND of the window that is currently in the foreground.
I've noticed that UWP Apps are just ApplicationFrameHost.exe processes and the foreground HWND points to an ApplicationFrameHost window. Per another StackOverflow post, to find the actual HWND of the app window, I am supposed to find the first child window of that window that does not belong to the same process, then do my processing there. My processing is just finding the AUMID.
Is there any way to get the app window HWND, or the AUMID, as soon as the ApplicationFrameHost is launched, instead of waiting for the app window to be fully initialized?