我该如何开始在.NET中使用闲置优先级的进程 [英] How do I start a process with idle priority in .Net

查看:146
本文介绍了我该如何开始在.NET中使用闲置优先级的进程的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我用System.Diagnostics.ProcessStartInfo设置的参数,从.NET程序启动一个过程。一旦这个过程开始时,我可以使用

I'm using System.Diagnostics.ProcessStartInfo to set up the parameters for launching a process from a .Net program. Once the the process is started, I can use

myProcess.PriorityClass = ProcessPriorityClass.Idle

要更改优先级的进程闲置,因此,它只能运行在后台,不养猪我的CPU处理能力。是否有使用ProcessStartInfo对象到指定的进程应该从一个空闲的优先权,因此,在任何时候执行过程中的进程比怠速较高的运行什么办法?

to change the priority for the process to idle, so that it only runs in the background, and doesn't hog my CPU power. Is there any way using the ProcessStartInfo object to specify that the process should start with an "Idle" priority, so that at no time during execution is the process running at higher than idle speed?

推荐答案

启动过程中暂停,然后更改优先级,然后恢复的过程。您可以使用此功能是通过的CreateProcess Win32函数在 CREATE_SUSPENDED 标志可惜我不知道如果有支持.NET的这一点,你可能需要求助于的P / Invoke

Start the process suspended, then change the priority, and then resume the process. You do this with the CreateProcess Win32 function using the CREATE_SUSPENDED flag but unfortunately I am not sure if there's support in .NET for this and you might need to resort to P/Invoke.

这篇关于我该如何开始在.NET中使用闲置优先级的进程的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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