Google Answers Logo
View Question
 
Q: Changing the Process Priority in C++ (Windows) ( No Answer,   3 Comments )
Question  
Subject: Changing the Process Priority in C++ (Windows)
Category: Computers > Programming
Asked by: avalanche-ga
List Price: $14.50
Posted: 22 Dec 2003 20:03 PST
Expires: 23 Dec 2003 01:35 PST
Question ID: 289638
I've written an unmanaged C++ console application using MS Visual Studio .NET
2003.  The program is a server that is called by Apache that does some
lengthy processing.  I'm not very familiar with the Windows API so I'd
appreciate it if somebody can just give me the ***raw C++ code to change
the application's own process priority down one notch below 'normal'***.  Thanks.
Answer  
There is no answer at this time.

Comments  
Subject: Re: Changing the Process Priority in C++ (Windows)
From: wonlay-ga on 22 Dec 2003 23:42 PST
 
#include <windows.h>
//include Kernel32.lib in link parameters
//......
if (
    SetPriorityClass (
                    GetCurrentProcess(),
                    BELOW_NORMAL_PRIORITY_CLASS
                     );
//......
/*
REALTIME_PRIORITY_CLASS------highest
HIGH_PRIORITY_CLASS
ABOVE_NORMAL_PRIORITY_CLASS
NORMAL_PRIORITY_CLASS
BELOW_NORMAL_PRIORITY_CLASS
IDLE_PRIORITY_CLASS------lowest
*/
Subject: Re: Changing the Process Priority in C++ (Windows)
From: wonlay-ga on 23 Dec 2003 00:06 PST
 
//Sorry, like that ~
~_#include <windows.h>
//include Kernel32.lib in link parameters
//......
SetPriorityClass (
                  GetCurrentProcess(),
                  BELOW_NORMAL_PRIORITY_CLASS
                  );
//......
Subject: Re: Changing the Process Priority in C++ (Windows)
From: avalanche-ga on 23 Dec 2003 01:31 PST
 
Wow, simple enough. :)  It worked.  Thanks, wonlay.

Important Disclaimer: Answers and comments provided on Google Answers are general information, and are not intended to substitute for informed professional medical, psychiatric, psychological, tax, legal, investment, accounting, or other professional advice. Google does not endorse, and expressly disclaims liability for any product, manufacturer, distributor, service or service provider mentioned or any opinion expressed in answers or comments. Please read carefully the Google Answers Terms of Service.

If you feel that you have found inappropriate content, please let us know by emailing us at answers-support@google.com with the question ID listed above. Thank you.
Search Google Answers for
Google Answers  


Google Home - Answers FAQ - Terms of Service - Privacy Policy