get all the process in my computer in uwp

岁酱吖の 提交于 2019-12-13 03:13:09

问题


I have a problem when I having my UWP development.In my application, I need to get all the apps details(including its displayname or the ExecutableFileName), which is running in the computer.

My first solution is to to use the System.Process class, and I do it like

    private void Mybutton_Click(object sender, RoutedEventArgs e)
    {
        var apps = Process.GetProcesses();
        ...
    }

But it is not availbale in the UWP and throws a exception when I try to do it.

Secondly,I have tried the System.AppDiagnostics class, but the class only show the UWP applications details.

And, what have disappointed me a lot is that, when I try to find solution in website. Nearly all the advice does not work, and I have found that UWP apps are sandboxed, that means, there is limited ways to do it.

This part will be the most important part in my application.So I have a question, how can I know all the process details in my computer. And I will appreciate a lot if you can provide me with helpful solutions, thanks.


回答1:


Currently, You could use UWP App Diagnostics to get info of the running uwp app that contain Win32 process.

The final versions for the upcoming release are available in the Insider builds from Build 16226, along with the corresponding SDK.

At a high level, these APIs allow an app to:

Enumerate a list of running apps, including UWP apps, Win32 apps, system services and so on.

And this UWP Task Monitor code sample that you could refer.



来源:https://stackoverflow.com/questions/51386038/get-all-the-process-in-my-computer-in-uwp

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!