Ascendant,
Thank you very much for putting your time into this
I have only had a brief look at the code, but knowing where to start has made this a lot clearer to me! (I don't know why I didn't do a search for "init")
As I said, I've only had a quick look and haven't tried to compile anything, but would something like this work:
Func GetProcessList($pc)
$hPDHQueryHandle=_PDH_GetNewQueryHandle()
$hPDHPIDCounterHandle=_PDH_AddCounter($hPDHQueryHandle,":230\784\(*)\" & $pc)
$hPDHCPUCounterHandle=_PDH_AddCounter($hPDHQueryHandle,":230\6\(*)\" & $pc)
$hPDHPPIDCounterHandle=_PDH_AddCounter($hPDHQueryHandle,":230\1410\(*)\" & $pc)
$hPDHMemCounterHandle=_PDH_AddCounter($hPDHQueryHandle,":230\180\(*)\" & $pc)
$hPDHTimeCounterHandle=_PDH_AddCounter($hPDHQueryHandle,":230\684\(*)\" & $pc)
$aProcessArray
_PDH_ProcessStats($hPDHQueryHandle,$aProcessArray, _
$hPDHPIDCounterHandle,$hPDHPPIDCounterHandle,$hPDHCPUCounterHandle,$hPDHMemCounterHandle,$hPDHTimeCounterHandle,1)
If @error Then
Terminate("Get Process List Fail")
EndIf
$aProcessArray[0][0]="Process Name"
$aProcessArray[0][1]="Process ID"
$aProcessArray[0][2]="Parent PID"
$aProcessArray[0][3]="CPU Usage"
$aProcessArray[0][4]="Memory Usage"
$aProcessArray[0][5]="Process Creation FileTime +\- 1 sec"
$aProcessArray[0][6]="Process Creation Time +\- 1 sec"
EndFunc
Func UpdateProcessList($pc)
_PDH_UpdateCounterArray($hPDHQueryHandle,$hPDHPIDCounterHandle,":230\784\(*)\" & $pc)
_PDH_UpdateCounterArray($hPDHQueryHandle,$hPDHCPUCounterHandle,":230\6\(*)\" & $pc)
_PDH_UpdateCounterArray($hPDHQueryHandle,$hPDHPPIDCounterHandle,":230\1410\(*)\" & $pc)
_PDH_UpdateCounterArray($hPDHQueryHandle,$hPDHMemCounterHandle,":230\180\(*)\" & $pc)
_PDH_UpdateCounterArray($hPDHQueryHandle,$hPDHTimeCounterHandle,":230\684\(*)\" & $pc)
EndFunc
Func WriteProcessInfo()
;Search array for required process
;Write desired info to file
EndFunc
Is this the best approach? (assuming that this is even remotely correct )
Thank you again for all your help!
Scott.