Code: Select all
Define.COMateObject wmiobj, process
Define.COMateEnumObject query
Define.l c, result
wmiobj = COMate_GetObject("winmgmts://./root/cimV2")
query = wmiobj\CreateEnumeration("ExecQuery('Select * from Win32_Process')")
c=1
If query
Repeat
process=query\GetNextObject()
result=COMate_GetLastErrorCode()
If result=#S_OK
Debug "Process "+Str(c)+" Executable path: "+process\GetStringProperty("ExecutablePath")
EndIf
c+1
Until result=#S_FALSE Or result=#E_FAIL
query\release()
EndIf
wmiobj\release()I'm trying to make sense of this .Net code as a basis for this: http://weblogs.asp.net/whaggard/archive ... 38006.aspx. Trying the query string in that .net code as a 'Notification query' using WBEMTEST (a built-in WMI browser), seems to work.
So, I assume I need to do something with SetEventHandler and that query string, but I can't see how to do this. Can anyone with more (any!) COM / WMI experience point me in the right direction here?
Alternatively, does anyone know of a way of doing this without involving COM / WMI in the first place?


