' Fait la liste des threads qui s'executent
Public Sub ListThreads(ByRef tabThreadID() As Long)
Dim hSnapshot As Long
Dim Thread As THREADENTRY32, Compteur As Long
ReDim tabThreadID(0) As Long
Compteur = 0
' On crée une capture des threads du système
hSnapshot = CreateToolhelp32Snapshot(TH32CS_SNAPTHREAD, 0&)
Thread.dwSize = Len(Thread)
' On prend le premier
If Thread32First(hSnapshot, Thread) Then
Thread.dwSize = Len(Thread)
' On parcourt tous les threads existants
Do
ReDim Preserve tabThreadID(Compteur) As Long
' On le liste
tabThreadID(Compteur) = Thread.th32ThreadID
Compteur = Compteur + 1
Loop While Thread32Next(hSnapshot, Thread)
End If
CloseHandle hSnapshot
End Sub
23/11/2006 : Correction dun petit bug
23/11/2006 : bug daffichage
23/11/2006 : changement du nom de la fonction
Le 30/12/2006 par MadMatt : Petit bug daffichage
Seul les admins et l'auteur du code lui même peuvent modifier ce code.