ATTENTION: You are viewing a page formatted for mobile devices; to view the full web page, click HERE.

Other Software > Developer's Corner

Q1 [Answered] Making a process and then changing its priority

(1/1)

mediaguycouk:
Hi there. I'm back to C# and am getting by with web examples and a few books. However I'm stuck.

I've created a process and it happens to be FFMPEG


--- Code: C# ---System.Diagnostics.Process proc = new System.Diagnostics.Process();            //Some rubbish but long code removed            proc.EnableRaisingEvents = false;            proc.StartInfo.FileName = ffmpegLocation;            proc.StartInfo.Arguments = arguement;            proc.StartInfo.UseShellExecute = false;            if (showEncodingEngine)            {                proc.StartInfo.CreateNoWindow = false;            }            else            {                proc.StartInfo.CreateNoWindow = true;            }            proc.StartInfo.RedirectStandardOutput = false;            proc.StartInfo.RedirectStandardInput = false;            proc.StartInfo.RedirectStandardError = false;            proc.Start();            proc.WaitForExit();            proc.Close();
What I'd like to do is to have this process run in BelowNormal processor priority. I've found some things in the intelitext about it, but msdn isn't really helping me.

Psudo code would be

proc.Start();
proc.processorpriority = priority.BelowNormal;

But it isn't that easy...

Thanks for any help

Ehtyar:

--- ---proc.PriorityClass = ProcessPriorityClass.BelowNormal;
Documentation for PriorityClass class here and documentation for the ProcessPriorityClass enum here.

Hope this helps, Ehtyar.

mediaguycouk:
Thanks for that. Really hard to get things like this exactly right without working code snippits


--- Code: C# ---System.Diagnostics.Process proc = new System.Diagnostics.Process();proc.Start();proc.PriorityClass = System.Diagnostics.ProcessPriorityClass.BelowNormal;proc.WaitForExit();proc.Close();

Navigation

[0] Message Index

Go to full version