Deklaration: Private Declare Function Process32First Lib "kernel32.dll" ( _ ByVal hSnapshot As Long, _ lppe As PROCESSENTRY32) As Long Beschreibung: Parameter:
Rückgabewert: Beispiel: Private Declare Function CreateToolhelp32Snapshot Lib "kernel32.dll" ( _ ByVal dwFlags As Long, _ ByVal th32ProcessID As Long) As Long Private Declare Function Process32First Lib "kernel32.dll" ( _ ByVal hSnapshot As Long, _ lppe As PROCESSENTRY32) As Long Private Declare Function Process32Next Lib "kernel32.dll" ( _ ByVal hSnapshot As Long, _ lppe As PROCESSENTRY32) As Long Private Declare Function CloseHandle Lib "kernel32.dll" ( _ ByVal hObject As Long) As Long Private Declare Function lstrlen Lib "kernel32" _ Alias "lstrlenA" ( _ ByVal lpString As String) As Long 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 * 260 End Type Private Const TH32CS_INHERIT = &H80000000 Private Const TH32CS_SNAPALL = &HF Private Const TH32CS_SNAPHEAPLIST = &H1 Private Const TH32CS_SNAPPROCESS = &H2 Private Const TH32CS_SNAPTHREAD = &H4 Private Const TH32CS_SNAPMODULE = &H8 ' alle laufenden Prozesse ermitteln Private Sub Command1_Click() Dim Retval As Long Dim hSnap As Long Dim PInfo As PROCESSENTRY32 ' Snapshot vom gesamten System erstellen hSnap = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0&) If hSnap = -1 Then MsgBox "Der System-Snapshot konnte nicht erstellt werden.", _ vbInformation, "Fehler" Exit Sub End If PInfo.dwSize = Len(PInfo) Retval = Process32First(hSnap, PInfo) ' ersten Prozess ermitteln List1.Clear Do Until Retval = 0 With PInfo .szExeFile = Trim$(Left$(.szExeFile, lstrlen(.szExeFile))) _ ' VBNullChar abtrennen List1.AddItem "# " & Format$(Abs(.th32ProcessID), "00000000") & " - _ " & Mid$(.szExeFile, InStrRev(.szExeFile, "\") + 1) End With Retval = Process32Next(hSnap, PInfo) ' nächsten Prozess ermitteln DoEvents Loop CloseHandle hSnap ' Snapshot zerstören End Sub Diese Seite wurde bereits 9.012 mal aufgerufen. |
vb@rchiv CD Vol.6 Geballtes Wissen aus mehr als 8 Jahren vb@rchiv! Online-Update-Funktion Entwickler-Vollversionen u.v.m. Buchempfehlung Tipp des Monats März 2024 Dieter Otter UTF-8 Konvertierung von Dateien und Strings VB6 selbst verfügt über keine Funktionen zur UTF-8 Konvertierung von Daten. Mit Hilfe des ADODB.Stream-Objekts lassen sich diese fehlenden Funktionen aber schnell nachrüsten. sevZIP40 Pro DLL Zippen und Unzippen wie die Profis! Mit nur wenigen Zeilen Code statten Sie Ihre Anwendungen ab sofort mit schnellen Zip- und Unzip-Funktionen aus. Hierbei lassen sich entweder einzelnen Dateien oder auch gesamte Ordner zippen bzw. entpacken. |
||||||||||||||
Microsoft, Windows und Visual Basic sind entweder eingetragene Marken oder Marken der Microsoft Corporation in den USA und/oder anderen Ländern. Weitere auf dieser Homepage aufgeführten Produkt- und Firmennamen können geschützte Marken ihrer jeweiligen Inhaber sein. |