Private Declare Function OpenProcess Lib "kernel32" (ByVal dwDesiredAccess As Long, ByVal bInheritHandle As Long, ByVal dwProcessId As Long) As Long
Private Declare Function GetWindowThreadProcessId Lib "user32" (ByVal hwnd As Long, lpdwProcessId As Long) As Long
Private Declare Function SetPriorityClass Lib "kernel32" (ByVal hProcess As Long, ByVal dwPriorityClass As Long) As Long
Private Const NORMAL_PRIORITY_CLASS = &H20
Private Const IDLE_PRIORITY_CLASS = &H40
Private Const HIGH_PRIORITY_CLASS = &H80
private we as long,proc as long
'You can give any window handle instead of me.hwnd(form window)
GetWindowThreadProcessId(Me.hwnd, we)
'Get process handle of your window
proc = OpenProcess(0, False, we)
'Set the priority class of the window
SetPriorityClass proc, HIGH_PRIORITY_CLASS
|