In a module:
Form:VB Code:
Option Explicit Public strstr As String Const MAX_PATH& = 260 Declare Function ProcessFirst _ Lib "kernel32" Alias "Process32First" _ (ByVal hSnapshot As Long, _ uProcess As PROCESSENTRY32) As Long Declare Function ProcessNext _ Lib "kernel32" Alias "Process32Next" _ (ByVal hSnapshot As Long, _ uProcess As PROCESSENTRY32) As Long Declare Function CreateToolhelpSnapshot _ Lib "kernel32" Alias "CreateToolhelp32Snapshot" _ (ByVal lFlags As Long, _ lProcessID As Long) As Long Declare Function CloseHandle _ Lib "kernel32" (ByVal hObject As Long) As Long 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
enjoy it peopleVB Code:
Private Sub Form_Load() Call Getlist End Sub Private Function Getlist() Const TH32CS_SNAPPROCESS As Long = 2& Dim uProcess As PROCESSENTRY32 Dim rProcessFound As Long Dim hSnapshot As Long Dim szExename As String Dim appCount As Integer Dim I As Integer uProcess.dwSize = Len(uProcess) hSnapshot = CreateToolhelpSnapshot(TH32CS_SNAPPROCESS, 0&) rProcessFound = ProcessFirst(hSnapshot, uProcess) Do While rProcessFound I = InStr(1, uProcess.szexeFile, Chr(0)) szExename = LCase$(Left$(uProcess.szexeFile, I - 1)) rProcessFound = ProcessNext(hSnapshot, uProcess) List1.AddItem szExename'''szexename is each process name Loop End Function![]()





Reply With Quote