Thanks!
The following code works and does what I was looking for, but in Windows XP pro that I am using the Windows Task Manager still shows
the Base Priority as Normal. I can tell by looking at CPU percent of utilization that the code is working.
using System.Threading; // for Thread
public static void GetPriority() // display priority status
{
string st = Thread.CurrentThread.Priority.ToString();
Console.WriteLine("Priority is " + st);
}
public static void SetPriority(int p) // change priority to p
{
if (p == 2)
Thread.CurrentThread.Priority = ThreadPriority.Highest;
else if (p == 1)
Thread.CurrentThread.Priority = ThreadPriority.AboveNormal;
else if (p == -1)
Thread.CurrentThread.Priority = ThreadPriority.BelowNormal;
else if (p == -2)
Thread.CurrentThread.Priority = ThreadPriority.Lowest;
else
Thread.CurrentThread.Priority = ThreadPriority.Normal;
GetPriority();
}
-Harry
"Richard" <Ri*****@discussions.microsoft.com> wrote in message news:D0**********************************@microsof t.com...
using System.Threading;
...
Thread.CurrentThread.Priority = ThreadPriority.BelowNormal;
...
--Richard
"Harry J. Smith" wrote:
How can a program change its execution priority in the operating system while it is running?
-Harry