Dwza February 2016

How to find Windows Universal app windows from C#

I want to write my own program that lets me select one Window of ALL open windows and set the state of this window to TOP, so that this selected window will always show on top!

The problem... since Windows 8 there are APPs and actually the process comes up in the process explorer but my selection of my tool doesn't list it. (Its like there is no app)

My source looks like:

private void refreshWindowList(object sender, EventArgs e)
{
    windowList.Items.Clear();

    foreach (Process p in Process.GetProcesses().Where(pp => pp.MainWindowHandle != IntPtr.Zero && pp.ProcessName != "explorer"))
    {
        windowList.Items.Add(p.ProcessName);
    }
}

This function is called when I open my combobox and actually refresh the Items every time when I view the list.

I find normal programs, but is there a way to find Win 8/10 apps ?

EDIT to clarify: Normal processes like notepad can be found. But Windows Universal apps like e.g. netflix can't. At least I don't know how to find them.

Answers


Stijn February 2016

Some applications, e.g. Netflix, are written using HTML and JavaScript. These apps are hosted by WWAHost:

[...] Microsoft explains WWAHost as “an Internet Explorer-based rendering platform.”

You can check if this is the case for an app by right clicking it in the Task Manager and choosing Go to details:

task manager processes

task manager details

To find out which app is being hosted, you can use MainWindowTitle

Console.WriteLine(p.ProcessName); // WWAHost
Console.WriteLine(p.MainWindowTitle); // Netflix

Post Status

Asked in February 2016
Viewed 2,105 times
Voted 6
Answered 1 times

Search




Leave an answer