In a module:
VB Code:
  1. Option Explicit
  2. Public strstr As String
  3. Const MAX_PATH& = 260
  4.  
  5. Declare Function ProcessFirst _
  6. Lib "kernel32" Alias "Process32First" _
  7. (ByVal hSnapshot As Long, _
  8. uProcess As PROCESSENTRY32) As Long
  9. Declare Function ProcessNext _
  10. Lib "kernel32" Alias "Process32Next" _
  11. (ByVal hSnapshot As Long, _
  12. uProcess As PROCESSENTRY32) As Long
  13. Declare Function CreateToolhelpSnapshot _
  14. Lib "kernel32" Alias "CreateToolhelp32Snapshot" _
  15. (ByVal lFlags As Long, _
  16. lProcessID As Long) As Long
  17. Declare Function CloseHandle _
  18. Lib "kernel32" (ByVal hObject As Long) As Long
  19.  
  20.  
  21. Type PROCESSENTRY32
  22. dwSize As Long
  23. cntUsage As Long
  24. th32ProcessID As Long
  25. th32DefaultHeapID As Long
  26. th32ModuleID As Long
  27. cntThreads As Long
  28. th32ParentProcessID As Long
  29. pcPriClassBase As Long
  30. dwFlags As Long
  31. szexeFile As String * MAX_PATH
  32. End Type
Form:
VB Code:
  1. Private Sub Form_Load()
  2. Call Getlist
  3. End Sub
  4.  
  5. Private Function Getlist()
  6. Const TH32CS_SNAPPROCESS As Long = 2&
  7. Dim uProcess As PROCESSENTRY32
  8. Dim rProcessFound As Long
  9. Dim hSnapshot As Long
  10. Dim szExename As String
  11. Dim appCount As Integer
  12. Dim I As Integer
  13.  
  14. uProcess.dwSize = Len(uProcess)
  15. hSnapshot = CreateToolhelpSnapshot(TH32CS_SNAPPROCESS, 0&)
  16. rProcessFound = ProcessFirst(hSnapshot, uProcess)
  17. Do While rProcessFound
  18. I = InStr(1, uProcess.szexeFile, Chr(0))
  19. szExename = LCase$(Left$(uProcess.szexeFile, I - 1))
  20. rProcessFound = ProcessNext(hSnapshot, uProcess)
  21. List1.AddItem szExename'''szexename is each process name
  22. Loop
  23. End Function
enjoy it people