|
| Autor |
Nachricht |
R3curial_ Tutorial Leser


Anmeldedatum: 24.06.2007 Beiträge: 23
|
Prozesse aulesen?
Verfasst am: 24.07.2007, 23:18 |
|
|
| wie kann ich mit vb 6 die laufenden prozesse im taskmanager auslesen. und sie dann in einer listbox erscheinen lassen? |
|
| |
|
 |
Viktor « Webmaster »

Anmeldedatum: 08.12.2006 Beiträge: 354 Wohnort: Berlin
|
Verfasst am: 24.07.2007, 23:29 |
|
|
[code]'Komponenten: 1 ListVIEW "List1" - 1 Timer "Timer1"
Private Declare Function CreateToolhelp32Snapshot Lib "kernel32" _
(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)
Const TH32CS_SNAPPROCESS As Long = 2&
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 Sub Form_Load()
List1.ColumnHeaders.Add , , "Prozesse", List1.Width - 500
List1.Width = Form1.Width
List1.Height = Form1.Height
Timer1.Interval = 100
Timer1.Enabled = True
End Sub
Private Sub GetExeNames()
Dim hSnapShot As Long, Result As Long
Dim aa As String, bb As String
Dim Process As PROCESSENTRY32
hSnapShot = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0&)
If hSnapShot = 0 Then Exit Sub
Process.dwSize = Len(Process)
Result = ProcessFirst(hSnapShot, Process)
Do While Result <> 0
aa = Process.szExeFile
aa = Left$(aa, InStr(aa, Chr$(0)) - 1)
If Right$(LCase(aa), 4) = ".exe" Then
List1.ListItems.Add , , aa
End If
Result = ProcessNext(hSnapShot, Process)
Loop
Call CloseHandle(hSnapShot)
End Sub
Private Sub Form_Resize()
List1.Width = Form1.Width
List1.Height = Form1.Height
End Sub
Private Sub Timer1_Timer()
DoEvents
List1.ListItems.Clear
Call GetExeNames
DoEvents
For i = 1 To List1.ListItems.Count
Select Case List1.ListItems.Item(i).Text
Case "qip.exe"
MsgBox "qip"
Case "explorer.exe"
MsgBox "explorer"
End Select
Next i
End Sub
[/code] |
|
| |
|
 |
R3curial_ Tutorial Leser


Anmeldedatum: 24.06.2007 Beiträge: 23
|
Verfasst am: 25.07.2007, 09:12 |
|
|
| thx werd mal schauen ob ich da durchblicke. |
|
| |
|
 |
|
|