Daniel

Daniel

  • NA
  • 8
  • 0

Watching events using WMI and WQL

Jul 19 2008 12:47 PM

Here is my program, a very basic one:

ManagementBaseObject _mBaseObj;

ManagementClass _mClass;

ManagementEventWatcher _mEventWatcher;

EventQuery _eQuery;

_mClass = new ManagementClass("Win32_Process");

_eQuery = new EventQuery("SELECT * FROM __InstanceCreationEvent WHERE ISA \"Win32_Process\"");

_mEventWatcher = new ManagementEventWatcher(_eQuery);

_mEventWatcher.EventArrived += new EventArrivedEventHandler(_mEventWatcher_EventArrived);

_mEventWatcher.Start();

 

This program pops-up a "ManagementException was unhandled" - Unparsable Query.

I have no clue why this happens, so I would thank anyone who might help me resolving this issue.

thx guyz. 


Answers (1)