Quantcast
Channel: Windows Desktop Development for Accessibility and Automation forum
Viewing all articles
Browse latest Browse all 585

Application Info for Modern/Universal "Apps"

$
0
0

The following sample has returned the name of the process that is associated with the active window, but does not work with the newer modern/universal apps because it returns a helper processWWAHost.exe on Windows 8 and ApplicationFrameHost.exe on Windows 10.

HWND active_window = GetForegroundWindow();
GetWindowThreadProcessId(active_window,&active_process_id );
HANDLE active_process = OpenProcess(
    PROCESS_QUERY_INFORMATION | PROCESS_VM_READ,
    FALSE, active_process_id );
GetProcessImageFileName( active_process,
    image_name, 512 );

With Windows 10 the ApplicationFrameHost.exe is the process that creates the window handles and is what gets returned by GetWindowThreadProcessId(), is there another Win32 API that can be used to get the active process of universal app that is active?

Also tried using GetApplicationUserModelId() and GetPackageFullName() with no success as they return APPMODEL_ERROR_NO_APPLICATION and APPMODEL_ERROR_NO_PACKAGE respectively because the active_process handle is just the helper process and not the process of the active application.

Any other APIs to use to get the process name of a Modern/Universal application given the hwnd of the window, or otherwise figure out the process name of the universal app is active.

Thanks in advance!


Viewing all articles
Browse latest Browse all 585

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>