Si si on peut le faire simplement...
SetPriorityClass
' ******** Code Start ********
'This code was originally written by Dev Ashish.
'It is not to be altered or distributed,
'except as part of an application.
'You are free to use it in any application,
'provided the copyright notice is left unchanged.
'
'Code Courtesy of
'Dev Ashish
'
' function returns a handle to an existing process object
Private Declare Function apiOpenProcess _
Lib "kernel32" Alias "OpenProcess" _
(ByVal dwDesiredAccess As Long, _
ByVal bInheritHandle As Long, _
ByVal dwProcessId As Long) _
As Long
' function sets the priority class for the specified process.
' This value together with the priority value of each thread
' of the process determines each thread's base priority level.
Private Declare Function apiSetPriorityClass _
Lib "kernel32" Alias "SetPriorityClass" _
(ByVal hProcess As Long, _
ByVal dwPriorityClass As Long) _
As Long
' function returns the priority class for the specified process.
Private Declare Function apiGetPriorityClass _
Lib "kernel32" Alias "GetPriorityClass" _
(ByVal hProcess As Long) _
As Long
' retrieves the identifier of the thread that created the specified
' window and, optionally, the identifier of the process
' that created the window.
Private Declare Function apiGetWindowThreadProcessId _
Lib "user32" Alias "GetWindowThreadProcessId" _
(ByVal hWnd As Long, _
lpdwProcessId As Long) _
As Long
' closes an open object handle.
Private Declare Function apiCloseHandle _
Lib "kernel32" Alias "CloseHandle" _
(ByVal hObject As Long) _
As Long
Private Const PROCESS_QUERY_INFORMATION = &H400
Private Const PROCESS_SET_INFORMATION = &H200
' Win2000: Indicates a process that has priority above
' IDLE_PRIORITY_CLASS but below NORMAL_PRIORITY_CLASS.
Public Const BELOW_NORMAL_PRIORITY_CLASS = &H4000
' Win2000: Indicates a process that has priority above
' NORMAL_PRIORITY_CLASS but below HIGH_PRIORITY_CLASS.
Public Const ABOVE_NORMAL_PRIORITY_CLASS = &H8000
' Win2000 end
' Indicates a normal process with no special scheduling needs.
Public Const NORMAL_PRIORITY_CLASS = &H20
' Indicates a process whose threads run only when the system is
' idle and are preempted by the threads of any process
' running in a higher priority class.
Public Const IDLE_PRIORITY_CLASS = &H40
' Indicates a process that performs time-critical tasks that
' must be executed immediately for it to run correctly.
' The threads of a high-priority class process preempt the threads
' of normal or idle priority class processes.
Public Const HIGH_PRIORITY_CLASS = &H80
' Indicates a process that has the highest possible priority.
' The threads of a real-time priority class process preempt the
' threads of all other processes, including operating system
' processes performing important tasks.
Public Const REALTIME_PRIORITY_CLASS = &H100
Function fChangeAccessPriority(lngPriority As Long) As Boolean
' -------------------------------
' NT / WIN2000 ONLY
' -------------------------------
' Changes Access's priority under NT
' MAKE SURE YOU READ AND UNDERSTAND THE WARNINGS
'
On Error GoTo ErrHandler
Dim lpProcessID As Long
Dim hProcess As Long
Dim lngRet As Long
' Get ProcessID for Access
Call apiGetWindowThreadProcessId(hWndAccessApp, lpProcessID)
' Get a handle to the current process
hProcess = apiOpenProcess( _
PROCESS_QUERY_INFORMATION Or _
PROCESS_SET_INFORMATION, _
False, _
lpProcessID)
If Not hProcess = 0 Then
' Get the current Priority
lngRet = apiGetPriorityClass(hProcess)
' If the priority specified is not the same as
' what's returned by GetPriorityClass
If Not lngRet = lngPriority Then
' then attempt to set the new priority for the process
lngRet = apiSetPriorityClass(hProcess, lngPriority)
fChangeAccessPriority = Not (lngRet = 0)
Else
' Specified priority is the same as the current
' priority, so no need to call the API function
fChangeAccessPriority = True
End If
End If
' close the handle
Call apiCloseHandle(hProcess)
ExitHere:
Exit Function
ErrHandler:
fChangeAccessPriority = False
Resume ExitHere
End Function
' ********* Code End ***********
Source :
http://www.mvps.org/access/api/api0059.htm