Private Declare Function GetCurrentProcess Lib "kernel32" () As Long Private Declare Function SetPriorityClass Lib "kernel32" (ByVal hProcess As Long,ByVal dwPriorityClass As Long) As Long Const IDLE_PRIORITY_CLASS = &H40 '新进程应该有非常低的优先级——只有在系统空闲的时候才能运行。基本值是4 Const HIGH_PRIORITY_CLASS = &H80 '新进程有非常高的优先级,它优先于大多数应用程序。基本值是13。注意尽量避免采用这个优先级 Const NORMAL_PRIORITY_CLASS = &H20 '标准优先级。如进程位于前台,则基本值是9;如在后台,则优先值是7 Dim CurrentProcesshWnd As Long '当前进程句柄 Private Sub Form_Load() CurrentProcesshWnd = GetCurrentProcess If (SetPriorityClass(CurrentProcesshWnd,HIGH_PRIORITY_CLASS) = 0) Then MsgBox "设置当前进程优先级为高。失败!" Else MsgBox "设置当前进程优先级为高。成功!" End If End Sub