Please give feed back.
add a button with the name cmdRefresh
add a button with the name cmdEnd
add a list with the name of list1, make sure it has a scroll bar.
FOLLOWING CODE IN A MODULE
Option Explicit
Public Const TH32CS_SNAPPROCESS As Long = 2&
Public Const MAX_PATH As Long = 260
Public 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
Public Declare Function CreateToolhelp32Snapshot Lib "kernel32" _
(ByVal lFlags As Long, ByVal lProcessID As Long) As Long
Public Declare Function ProcessFirst Lib "kernel32" _
Alias "Process32First" _
(ByVal hSnapshot As Long, uProcess As PROCESSENTRY32) As Long
Public Declare Function ProcessNext Lib "kernel32" _
Alias "Process32Next" _
(ByVal hSnapshot As Long, uProcess As PROCESSENTRY32) As Long
Public Declare Sub CloseHandle Lib "kernel32" _
(ByVal hPass As Long)
Now, Put this code in form load.
Private Sub Form_Load()
cmdRefresh.Value = True
Dim hSnapshot As Long
Dim uProcess As PROCESSENTRY32
Dim success As Long
hSnapshot = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0&)
If hSnapshot = -1 Then Exit Sub
uProcess.dwSize = Len(uProcess)
success = ProcessFirst(hSnapshot, uProcess)
If success = 1 Then
Do
List1.AddItem uProcess.szExeFile
Loop While ProcessNext(hSnapshot, uProcess)
End If
Call CloseHandle(hSnapshot)
End Sub
PUT THIS IN REFRESH BUTTON
Private Sub cmdRefresh_Click()
List1.Clear
Dim hSnapshot As Long
Dim uProcess As PROCESSENTRY32
Dim success As Long
hSnapshot = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0&)
If hSnapshot = -1 Then Exit Sub
uProcess.dwSize = Len(uProcess)
success = ProcessFirst(hSnapshot, uProcess)
If success = 1 Then
Do
List1.AddItem uProcess.szExeFile
Loop While ProcessNext(hSnapshot, uProcess)
End If
Call CloseHandle(hSnapshot)
End Sub
PUT THIS IN END BUTTON
I demand feedback, LOLPrivate Sub cmdEnd_Click()
End
End Sub![]()
![]()
![]()




Reply With Quote