'刷新进程信息 Private Sub RefreshProcessList() Dim myProcess As PROCESSENTRY32 Dim I As Integer Dim mySnapshot As Long Dim GEXEStr As String * 260 frmMain.listProcess.ListItems.Clear myProcess.dwSize = Len(myProcess) mySnapshot = CreateToolhelpSnapshot(TH32CS_SNAPPROCESS, 0&) ProcessFirst mySnapshot, myProcess
Private Sub RefreshProcessList()
Dim myProcess As PROCESSENTRY32
Dim I As Integer
Dim mySnapshot As Long
Dim GEXEStr As String * 260
frmMain.listProcess.ListItems.Clear
myProcess.dwSize = Len(myProcess)
mySnapshot = CreateToolhelpSnapshot(TH32CS_SNAPPROCESS, 0&)
ProcessFirst mySnapshot, myProcess
ReDim ProcessName(1)
ReDim ProcessPID(1)
ReDim ProcessLine(1)
ProcessName(0) = myProcess.szexeFile '如果是中文程序名得到是不对
ProcessPID(0) = myProcess.th32ProcessID
ProcessLine(0) = myProcess.cntThreads While ProcessNext(mySnapshot, myProcess)
ReDim Preserve ProcessName(UBound(ProcessName) + 1)
ReDim Preserve ProcessPID(UBound(ProcessName))
ReDim Preserve ProcessLine(UBound(ProcessName))
I = UBound(ProcessName) - 1
ProcessName(I) = myProcess.szexeFile
ProcessPID(I) = myProcess.th32ProcessID
ProcessPID(I) = myProcess.cntThreads
WendEnd Sub