HOWTO: How to Set Foreground/Background Responsiveness in Code

ID: Q125660


The information in this article applies to:
  • Microsoft Win32 Application Programming Interface (API), used with:
    • Microsoft Windows NT 3.5


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:

  • Best Foreground Application Response Time.


  • Foreground Application More Responsive than Background.


  • Foreground and Background Applications Equally Responsive.


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 kbGrpKernBase
Version : winnt:3.5
Platform : winnt
Issue type : kbhowto


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