SetThreadPriority 函数的优先级常量只有3个(高,正常,低),请问有没有“高于标准”?谢谢~~~

解决方案 »

  1.   

    可以设置七个优先级,如下:THREAD_PRIORITY_ABOVE_NORMAL
    1 Priority 1 point above the priority class. THREAD_PRIORITY_BELOW_NORMAL
    -1 Priority 1 point below the priority class. THREAD_PRIORITY_HIGHEST
    2 Priority 2 points above the priority class. THREAD_PRIORITY_IDLE
    -15 Base priority of 1 for IDLE_PRIORITY_CLASS, BELOW_NORMAL_PRIORITY_CLASS, NORMAL_PRIORITY_CLASS, ABOVE_NORMAL_PRIORITY_CLASS, or HIGH_PRIORITY_CLASS processes, and a base priority of 16 for REALTIME_PRIORITY_CLASS processes. THREAD_PRIORITY_LOWEST
    -2 Priority 2 points below the priority class. THREAD_PRIORITY_NORMAL
    0 Normal priority for the priority class. THREAD_PRIORITY_TIME_CRITICAL
    15 Base priority of 15 for IDLE_PRIORITY_CLASS, BELOW_NORMAL_PRIORITY_CLASS, NORMAL_PRIORITY_CLASS, ABOVE_NORMAL_PRIORITY_CLASS, or HIGH_PRIORITY_CLASS processes, and a base priority of 31 for REALTIME_PRIORITY_CLASS processes. 
      

  2.   

    SetThreadPriority不就是设置线程优先级吗?
      

  3.   

    天错了抱歉,随手一写写错了,应该是:
    SetPriorityClass
      

  4.   

    查阅MSDN,有六个优先级可以设置,如下:
    (VCL源码中只列出了四个)
    ABOVE_NORMAL_PRIORITY_CLASS
    0x00008000 Process that has priority above NORMAL_PRIORITY_CLASS but below HIGH_PRIORITY_CLASS.
    Windows NT and Windows Me/98/95:  This value is not supported. BELOW_NORMAL_PRIORITY_CLASS
    0x00004000 Process that has priority above IDLE_PRIORITY_CLASS but below NORMAL_PRIORITY_CLASS.
    Windows NT and Windows Me/98/95:  This value is not supported. HIGH_PRIORITY_CLASS
    0x00000080 Process that performs time-critical tasks that must be executed immediately. The threads of the process preempt the threads of normal or idle priority class processes. An example is the Task List, which must respond quickly when called by the user, regardless of the load on the operating system. Use extreme care when using the high-priority class, because a high-priority class application can use nearly all available CPU time. IDLE_PRIORITY_CLASS
    0x00000040 Process whose threads run only when the system is idle. The threads of the process are preempted by the threads of any process running in a higher priority class. An example is a screen saver. The idle-priority class is inherited by child processes. NORMAL_PRIORITY_CLASS
    0x00000020 Process with no special scheduling needs. REALTIME_PRIORITY_CLASS
    0x00000100 Process that has the highest possible priority. The threads of the process preempt the threads of all other processes, including operating system processes performing important tasks. For example, a real-time process that executes for more than a very brief interval can cause disk caches not to flush or cause the mouse to be unresponsive. 
      

  5.   

    TO boblaw :
    ABOVE_NORMAL_PRIORITY_CLASS定义在哪里?我只找到了后4个,前两个用不了。
      

  6.   

    那你自己定义啊const
      ABOVE_NORMAL_PRIORITY_CLASS=$0x00008000;
      BELOW_NORMAL_PRIORITY_CLASS=$0x00004000;