|
-
September 29th, 2005, 03:01 PM
#1
WMI, watching for multiple events in C#
Hi,
I have question regarding watching multiple events using ManagementEventwatcher in C#.
Following is the code
<code>
string eventquery = "SELECT * FROM __InstanceModificationEvent WITHIN 1 WHERE TargetInstance ISA \"Win32_Processor\" AND TargetInstance.Availability=3";
MyEventAsyncHandler handler = new MyEventAsyncHandler();
ManagementEventWatcher watcher = new ManagementEventWatcher(eventquery);
watcher.EventArrived += new EventArrivedEventHandler(handler.EventArrived);
watcher.Stopped += new StoppedEventHandler(handler.StoppedEvent);
watcher.Start();
</code>
Here in the event query, i can only watch for event modification of Win32_Processor. Is there a way to watch for multiple events , i.e can i watch for events of Win32_Processor, Win32_NetworkAdapter, Win32_Processor
I tried the query below, but it throws unparseable error at run time
</code>
//string eventquery = "SELECT * FROM __InstanceModificationEvent WITHIN 1 WHERE WHERE TargetInstance ISA \"Win32_Processor\" AND TargetInstance.Availability=3 OR WHERE TargetInstance ISA \"Win32_NetworkAdapter\" AND TargetInstance.Availability=3 ";
<code>
If someone has done this before, please let me know
TIA
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|