.NET如何检查Windows进程是否正在作为"App"运行?或作为“背景应用程序" [英] .NET How to check if a Windows process is running as an "App" or as a "Background application"

查看:50
本文介绍了.NET如何检查Windows进程是否正在作为"App"运行?或作为“背景应用程序"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Windows 8.1上,您进入任务管理器并检查进程列表,其中有两个列表:-一个用于应用程序",即可见的前台应用程序-一个用于后台进程",即在后台运行的进程

On Windows 8.1 you go into the task manager and check the list of processes, there are two lists: - One for "Apps", which are visible foreground apps - One for "Background processes", which are processes running in the background

我的最终目标是确定应用程序加载需要多长时间.当应用程序仍在加载时,它会出现在后台进程"中.但是,一旦加载,它就会出现在应用程序"中.这将成为我确定应用程序完成加载的标准.

My end goal is to time how long it takes an application to load. When the application is still loading, it appears in "Background processes". However, once loaded, it appears in "Apps". This is going to be my criteria on what constitutes an app finishing loading.

我正在使用System.Diagnostics.Process对象来尝试完成此任务.但是,我正在努力想出一种方法来区分背景流程"下的流程和应用程序"下的流程.

I am using a System.Diagnostics.Process object to try to accomplish this. However, I am struggling to come up with a way to distinguish between a Process under "Background processes" and a Process under "Apps".

有人对如何区分这一点有想法吗?我浏览了MSDN并尝试了不同的方法,但都没有成功.

Does anyone have an idea on how to make this distinction? I looked through MSDN and tried different methods, none of which have been successful.

推荐答案

属性

The property System.Diagnostics.Process.MainWindowHandle is zero when process has not UI (i.e. is background process).

这篇关于.NET如何检查Windows进程是否正在作为"App"运行?或作为“背景应用程序"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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