title: Name of process for active window in Windows 8/10
body: <p>The following sample has reliably 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 the name of a helper process <strong>WWAHost.exe</strong> on Windows 8 and <strong>ApplicationFrameHost.exe</strong> on Windows 10 rather than the name of the app.</p>
  
  <pre><code>HWND active_window = GetForegroundWindow();
  GetWindowThreadProcessId(active_window, &amp;active_process_id);
  HANDLE active_process = OpenProcess(PROCESS_QUERY_INFORMATION | PROCESS_VM_READ, FALSE, active_process_id);
  GetProcessImageFileName(active_process, image_name, 512);
  </code></pre>
  
  <p>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?</p>
  
  <p>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.</p>
  
  <p>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.</p>
  
  <p>Thanks in advance!</p>