Friday, June 4, 2010

Mercury Custom Objects 2 - "Mercury.ProcValues"

'Usage of Mercury Custom Objects
'Retrive process memory usage using reserved objects
'Source : Unknown

***********************************************************************
' Create the "Mercury.ProcValues" object

Set MyProcess = CreateObject("Mercury.ProcValues")

process = "Notepad"

MsgBox MyProcess.GetProcessValues(process, "MemUsage")

' Using "With"
With MyProcess
MsgBox .GetProcessValues(process, "BasePriority")
'---------------------------------------------------------------
MsgBox .GetProcessValues(process, "CPUTime")
'---------------------------------------------------------------
rc = .GetProcessValues(process, "Modules")
' Write modules list to file as the returned value is very large:
Set fso = CreateObject("Scripting.FileSystemObject")
Set f = fso.OpenTextFile("C:\Modules.txt", 2, True)
f.Write rc
f.Close
'---------------------------------------------------------------
MsgBox .GetProcessValues(process, "VMSize")
End with

Set MyProcess = NOTHING
'---------------------------------------------------------------

No comments: