在 uwp 中获取我计算机中的所有进程 [英] get all the process in my computer in uwp

查看:36
本文介绍了在 uwp 中获取我计算机中的所有进程的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在进行 UWP 开发时遇到问题.在我的应用程序中,我需要获取在计算机中运行的所有应用程序详细信息(包括其显示名称或 ExecutableFileName).

我的第一个解决方案是使用 System.Process 类,我喜欢这样做

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

但它在 UWP 中不可用,并且在我尝试执行时抛出异常.

其次,我尝试了 System.AppDiagnostics 类,但该类只显示 UWP 应用程序的详细信息.

而且,让我很失望的是,当我试图在网站上找到解决方案时.几乎所有的建议都不起作用,而且我发现 UWP 应用程序是沙盒化的,这意味着实现它的方法很有限.

这部分将是我申请中最重要的部分.所以我有一个问题,我怎么知道我电脑里的所有进程细节.如果您能为我提供有用的解决方案,我将不胜感激,谢谢.

解决方案

目前,您可以使用

您可以参考此 UWP 任务监视器 代码示例.

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.

解决方案

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.

这篇关于在 uwp 中获取我计算机中的所有进程的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆