VBcoders Browse New Submit Contact Sign In

No account? Register free

Forgot password?

List All Active Processes (Class)

Chong Long Choo  (4 Submissions)   Windows System Services   VB 6.0   Unknown Difficulty   Sat 9th October 1999   Mon 8th February 2021

List All Active Processes (Class)

API Declarations



' Name: List All Active Processes
' Author: Chong Long Choo
' Email: [email protected]
' Date: 09 September 1999

'<--------------------------Disclaimer------------------------------->
'
'This sample is free. You can use the sample in any form. Use this
'sample at your own risk! I have no warranty for this sample.
'
'<--------------------------Disclaimer------------------------------->

'---------------------------------------------------------------------------------
'How to use
'---------------------------------------------------------------------------------
' Dim i As Integer
' Dim objItem As ListItem
' Dim NumOfProcess As Long
' Dim objActiveProcess As SQLSysInfo.clsActiveProcess
' Set objActiveProcess = New SQLSysInfo.clsActiveProcess
' NumOfProcess = objActiveProcess.GetActiveProcess
' For i = 1 To NumOfProcess
' Set objItem = ListView2.ListItems.Add(, , objActiveProcess.szExeFile(i))
' With objItem
' .SubItems(1) = objActiveProcess.th32ProcessID(i)
' .SubItems(2) = objActiveProcess.th32DefaultHeapID(i)
' .SubItems(3) = objActiveProcess.thModuleID(i)
' .SubItems(4) = objActiveProcess.cntThreads(i)
' .SubItems(5) = objActiveProcess.th32ParentProcessID(i)
' End With
' Next
' Set objActiveProcess = Nothing

Private Const TH32CS_SNAPPROCESS As Long = 2&
Private Const MAX_PATH As Integer = 260

Private Type PROCESSENTRY32
dwSize As Long
cntUsage As Long
th32ProcessID As Long
th32DefaultHeapID As Long
th32ModuleID As Long
cntThreads As Long
th32ParentProcessID As Long
pcPriClassBase As Long
dwFlags As Long
szExeFile As String * MAX_PATH
End Type

Private Declare Function CreateToolhelpSnapshot Lib "kernel32" Alias "CreateToolhelp32Snapshot" (ByVal lFlags As Long, ByVal lProcessID As Long) As Long
Private Declare Function ProcessFirst Lib "kernel32" Alias "Process32First" (ByVal hSnapShot As Long, uProcess As PROCESSENTRY32) As Long
Private Declare Function ProcessNext Lib "kernel32" Alias "Process32Next" (ByVal hSnapShot As Long, uProcess As PROCESSENTRY32) As Long
Private Declare Sub CloseHandle Lib "kernel32" (ByVal hPass As Long)

Dim ListOfActiveProcess() As PROCESSENTRY32


Rate List All Active Processes (Class) (1(1 Vote))
List All Active Processes (Class).bas

List All Active Processes (Class) Comments

No comments yet — be the first to post one!

Post a Comment

0/1000 characters