#include <file.au3>
#include <Array.au3>
$Process="kwmusic.exe"
$Process="MyPopo.exe"
$sComputer = "."
Dim $log = "55.log"
Opt("GUIOnEventMode", 1)
dim $hong=@ScriptDir
_FileWriteLog($hong & $log, "5555")
;_FileWriteLog($hong & $log, _ProcessListProperties($Process = "", $sComputer = "."))
$aThread = _ProcessListProperties($Process, $sComputer)
_FileWriteLog($hong & $log, $aThread)
Dim $avProcs1
Dim $avProcs2
Func _ProcessListProperties($Process = "", $sComputer = ".")
Local $sUserName, $sUserDomain, $dtmDateD
Local $avProcs[1][2] = [[0]], $n = 1
Local $oWMI, $colProcs
If StringIsInt($Process) Then $Process = Int($Process)
$oWMI = ObjGet("winmgmts:{impersonationLevel=impersonate, authenticationLevel=pktPrivacy, (Debug)}!\" & $sComputer & "\root\CIMV2")
$colProcs = $oWMI.ExecQuery("SELECT * FROM Win32_Process WHERE ProcessId = " & $Process)
Local $oRefresher = ObjCreate("WbemScripting.SWbemRefresher")
$colProcs = $oRefresher.AddEnum($oWMI, "Win32_PerfFormattedData_PerfProc_Process").objectSet
$oRefresher.Refresh
Local $iTime = TimerInit()
Do
Sleep(20)
Until TimerDiff($iTime) >= 100
$oRefresher.Refresh
While True
$avProcs1 = $colProcs.PercentProcessorTime
$avProcs2= $colProcs.WorkingSet
WEnd
Return $avProcs1 & $avProcs2
EndFunc
|