Answered by:
Set the Process Priority to Low (BelowNormal)

Question
-
how do i set the process priority to low by using this processCaller class.
virtual void StartProcess()
protected{
// Start a new process for the cmdprocess =
new Process();process.StartInfo.UseShellExecute =
false;process.StartInfo.RedirectStandardOutput =
true;process.StartInfo.RedirectStandardError =
true;process.StartInfo.RedirectStandardInput =
true;process.StartInfo.CreateNoWindow =
true;process.StartInfo.FileName = FileName;
process.StartInfo.Arguments = Arguments;
process.StartInfo.WorkingDirectory = WorkingDirectory;
bool startRet = process.Start();
.....
Answers
-
In the Process class , you have a priorityclass Property
http://msdn.microsoft.com/en-us/library/system.diagnostics.process.priorityclass.aspx
If this post helps you, Please mark as answer
Thanks & Regards, Srinivasan- Marked as answer by Michael Sun [MSFT]Microsoft employee Friday, October 3, 2008 9:42 AM
-
Hello,
As we could see in the MSDN Library article Srinivasan suggested, Process.BasePriority is an integer property, also it is read-only. To set the process priority to BelowNormal, we could use such a line of code: myProcess.PriorityClass = ProcessPriorityClass.BelowNormal;
Also, if we want to check whether the process’s priority is BelowNormal, we could use these codes:
if (myProcess.PriorityClass.Equals(ProcessPriorityClass.BelowNormal))
{
}
Or
if (myProcess.PriorityClass.ToString().Equals("BelowNormal"))
{
}
Or
if (myProcess.BasePriority == 6)
{
}
Thanks,
Best Regards,
Lingzhi
Please remember to mark the replies as answers if they help and unmark them if they provide no help. http://forums.msdn.microsoft.com/en-US/csharpide/thread/8e9ed0d7-11ff-402a-8489-9b5f05eeb706 http://forums.msdn.microsoft.com/en-US/vssetup/thread/60424309-bd78-4ca2-b618-03c4a16123b6- Edited by Michael Sun [MSFT]Microsoft employee Thursday, October 2, 2008 6:25 AM modify
- Marked as answer by Michael Sun [MSFT]Microsoft employee Friday, October 3, 2008 9:42 AM
All replies
-
In the Process class , you have a priorityclass Property
http://msdn.microsoft.com/en-us/library/system.diagnostics.process.priorityclass.aspx
If this post helps you, Please mark as answer
Thanks & Regards, Srinivasan- Marked as answer by Michael Sun [MSFT]Microsoft employee Friday, October 3, 2008 9:42 AM
-
-
Hello,
As we could see in the MSDN Library article Srinivasan suggested, Process.BasePriority is an integer property, also it is read-only. To set the process priority to BelowNormal, we could use such a line of code: myProcess.PriorityClass = ProcessPriorityClass.BelowNormal;
Also, if we want to check whether the process’s priority is BelowNormal, we could use these codes:
if (myProcess.PriorityClass.Equals(ProcessPriorityClass.BelowNormal))
{
}
Or
if (myProcess.PriorityClass.ToString().Equals("BelowNormal"))
{
}
Or
if (myProcess.BasePriority == 6)
{
}
Thanks,
Best Regards,
Lingzhi
Please remember to mark the replies as answers if they help and unmark them if they provide no help. http://forums.msdn.microsoft.com/en-US/csharpide/thread/8e9ed0d7-11ff-402a-8489-9b5f05eeb706 http://forums.msdn.microsoft.com/en-US/vssetup/thread/60424309-bd78-4ca2-b618-03c4a16123b6- Edited by Michael Sun [MSFT]Microsoft employee Thursday, October 2, 2008 6:25 AM modify
- Marked as answer by Michael Sun [MSFT]Microsoft employee Friday, October 3, 2008 9:42 AM
-
In the Process class , you have a priorityclass Property
http://msdn.microsoft.com/en-us/library/system.diagnostics.process.priorityclass.aspx
If this post helps you, Please mark as answer
Thanks & Regards, Srinivasan
This seems not so helpful to me, Anybody can help? Thank you!