求个VB的枚举进程例子
来源:百度知道 编辑:UC知道 时间:2024/05/30 01:36:38
Option Explicit '强制变量声明
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 Declare Function CreateToolhelp32Snapshot Lib "kernel32" (ByVal dwFlags As Long, ByVal th32ProcessID As Long) As Long
Private Declare Function Process32First Lib "kernel32" (ByVal hSnapShot As Long, lppe As PROCESSENTRY32) As Long
Private Declare Function Process32Next Lib "kernel32" (ByVal hSnapShot As Long, lppe As PROCESSENTRY32) As Long
Private Const TH32CS_SNAPPROCESS = &H2&
Dim lSnapShot As Long
Dim lNextProcess As Long
Dim tPE As PROCESSENTRY32
lSnapShot = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0&)
If lSnapShot <>