' Pour ouvrir un thread
Public Declare Function OpenThread Lib "kernel32" (ByVal dwDesiredAccess As Long, ByVal bInherit As Long, ByVal dwThreadId As Long) As Long
Public Const THREAD_ALL_ACCESS = &H1F03FF
' Suspendre un thread
Public Declare Function SuspendThread Lib "kernel32" (ByVal hThread As Long) As Long
Public Declare Function ResumeThread Lib "kernel32" (ByVal hThread As Long) As Long
' Suspendre un thread
Public Function SuspendThread(ByVal ThreadID As Long)
Dim hThread As Long
' Renvoie le handle du thread "ouvert" (pour agir dessus)
hThread = OpenThread(THREAD_ALL_ACCESS, 0, ThreadID)
' Suspend le thread
SuspendThread hThread
' Ferme le handle
CloseHandle hThread
End Function
' Reprendre un thread (qui est suspendu)
Public Function ResumeThread(ByVal ThreadID As Long)
Dim hThread As Long
' Renvoie le handle du thread "ouvert" (pour agir dessus)
hThread = OpenThread(THREAD_ALL_ACCESS, 0, ThreadID)
' Reprend le thread
ResumeThread hThread
' Ferme le handle
CloseHandle hThread
End Function
Seul les admins et l'auteur du code lui même peuvent modifier ce code.