HOWTO: How to Set Foreground/Background Responsiveness in Code

Q125660


The information in this article applies to:


SUMMARY

In Windows NT version 3.5, you can set foreground/background responsiveness by using the System Control Panel in Program Manager. Chose Tasking, then select one of the following through the dialog that is displayed:

This article describes how to achieve the same thing by using code in a program. It also explains how to override this setting by using code in a program.


MORE INFORMATION

You can use the Registry APIs to set foreground/background responsiveness. The following registry key allows you to specify the priority to give to the application running in the foreground:


   HKEY_LOCAL_MACHINE\SYSTEM
      CurrentControlSet\ 
      Control\ 
      PriorityControl\ 
      Win32PrioritySeparation 
The following values are supported:

   Value    Meaning
   ----------------
   0        Foreground and background applications equally responsive
   1        Foreground application more responsive than background
   2        Best foreground application response time 
These values correspond to the choices offered in the Tasking dialog described in the "Summary" section of this article.

To override the setting from your application, use SetPriorityClass() to change your application's priority class and SetThreadPriority() to set the priority for a given thread.

NOTE: The thread priority together with the priority class for the process determine the thread's base priority.

Additional query words: 3.50

Keywords : kbKernBase kbThread kbDSupport kbGrpDSKernBase
Issue type : kbhowto
Technology : kbAudDeveloper kbWin32sSearch kbWin32API


Last Reviewed: October 20, 2000
© 2001 Microsoft Corporation. All rights reserved. Terms of Use.