Advertisement
5_2007-2008 Windows System Services #173302

List All Active Processes (Class)

List All Active Processes (Class)

AI

KI-Zusammenfassung: This codebase represents a historical implementation of the logic described in the metadata. Our preservation engine analyzes the structure to provide context for modern developers.

Quellcode
original-source
Public Function szExeFile(ByVal Index As Long) As String
  szExeFile = ListOfActiveProcess(Index).szExeFile
End Function
Public Function dwFlags(ByVal Index As Long) As Long
  dwFlags = ListOfActiveProcess(Index).dwFlags
End Function
Public Function pcPriClassBase(ByVal Index As Long) As Long
  pcPriClassBase = ListOfActiveProcess(Index).pcPriClassBase
End Function
Public Function th32ParentProcessID(ByVal Index As Long) As Long
  th32ParentProcessID = ListOfActiveProcess(Index).th32ParentProcessID
End Function
Public Function cntThreads(ByVal Index As Long) As Long
  cntThreads = ListOfActiveProcess(Index).cntThreads
End Function
Public Function thModuleID(ByVal Index As Long) As Long
  thModuleID = ListOfActiveProcess(Index).th32ModuleID
End Function
Public Function th32DefaultHeapID(ByVal Index As Long) As Long
  th32DefaultHeapID = ListOfActiveProcess(Index).th32DefaultHeapID
End Function
Public Function th32ProcessID(ByVal Index As Long) As Long
  th32ProcessID = ListOfActiveProcess(Index).th32ProcessID
End Function
Public Function cntUsage(ByVal Index As Long) As Long
  cntUsage = ListOfActiveProcess(Index).cntUsage
End Function
Public Function dwSize(ByVal Index As Long) As Long
  dwSize = ListOfActiveProcess(Index).dwSize
End Function
Public Function GetActiveProcess() As Long
  Dim hToolhelpSnapshot As Long
  Dim tProcess As PROCESSENTRY32
  Dim r As Long, i As Integer
  hToolhelpSnapshot = CreateToolhelpSnapshot(TH32CS_SNAPPROCESS, 0&)
  If hToolhelpSnapshot = 0 Then
    GetActiveProcess = 0
    Exit Function
  End If
  With tProcess
    .dwSize = Len(tProcess)
    r = ProcessFirst(hToolhelpSnapshot, tProcess)
    ReDim Preserve ListOfActiveProcess(20)
    Do While r
      i = i + 1
      If i Mod 20 = 0 Then ReDim Preserve ListOfActiveProcess(i + 20)
      ListOfActiveProcess(i) = tProcess
      r = ProcessNext(hToolhelpSnapshot, tProcess)
    Loop
  End With
  GetActiveProcess = i
  Call CloseHandle(hToolhelpSnapshot)
End Function
Originalkommentare (3)
Wiederhergestellt von der Wayback Machine