怎么列举系统进程?
怎么列举系统进程?
[解决办法]
http://topic.csdn.net/t/20051108/10/4378494.html
[解决办法]
Private Sub Command3_Click()
Dim strComputer As String
Dim objWMIService As Object
Dim colProcessList
Dim objProcess As Object
On Error Resume Next
strComputer = ". "
Set objWMIService = GetObject( "winmgmts: " & "{impersonationLevel=impersonate}!\\ " & strComputer & "\root\cimv2 ")
Set colProcessList = objWMIService.ExecQuery( "select * from win32_process ") 'where processid=1764
Debug.Print "=================================== "
For Each objProcess In colProcessList
'objProcess.SetPriority (256)
'If objProcess.GetOwner = "SYSTEM " Then
RET = objProcess.GetOwner(USERNAME)
If USERNAME = "SYSTEM " Then Debug.Print CStr(objProcess.Name), CStr(objProcess.processid), USERNAME
'Debug.Print objProcess.Name, objProcess.commandline
Next
End Sub