| |
Weazle
Posts: 1
Score: 0
Joined: 12/23/2004
From:
Status: offline
|
Based on wmi, I created in Visual basic 6 a sub to view processes from a remote pc. (That is for a tool i will use at work here) Now, I can see the name and if i like the Id etc.. But what i can't see and would like to see, is the locations of the process( for example, notepad.exe is stored on that pc on c:\windows\system32\notepad.exe) So the full path. And also the Cpu time(to check if a process takes 99% cpu or not) Can anybody help me with that? I'll post my code that i already used for showing the name. Private Sub Processen_Weergeven() Dim StrVorige As String Dim IntTeller As Integer On Error GoTo Foutmelding StrVorige = "" StrSelected_Process = "" IntTeller = 0 LstProcesses.ListItems.Clear LstProcesses.ColumnHeaders.Add 1, , "", 5000 Set objDictionary = CreateObject("Scripting.Dictionary") StrComputer = Me.Tag Set objWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\" & StrComputer & "\root\cimv2") Set colProcesses = objWMIService.ExecQuery("Select * from Win32_Process") For Each objProcess In colProcesses objDictionary.Add objProcess.ProcessID, objProcess.Name Next Set colThreads = objWMIService.ExecQuery("Select * from Win32_Thread") For Each objthread In colThreads intProcessID = CInt(objthread.processhandle) If (Vorige <> intProcessID) Then strProcessName = objDictionary.Item(intProcessID) Set mItem(IntTeller) = LstProcesses.ListItems.Add(1, , strProcessName) IntTeller = IntTeller + 1 End If Vorige = intProcessID Next LstProcesses.Sorted = True CmdProcessKill.Enabled = False Exit Sub Foutmelding: MsgBox "Er is een fout opgetreden bij het inlezen van de Processen.", vbCritical, "Error: Processen_Weergeven" Unload Me End Sub Thx in advance Edit: just info, the lstprocesses is a listview, but that isn't importent
|
|