ManagementEventWatcher Class
Subscribes to temporary event notifications based on a specified event query.
Assembly: System.Management (in System.Management.dll)
System::MarshalByRefObject
System.ComponentModel::Component
System.Management::ManagementEventWatcher
| Name | Description | |
|---|---|---|
![]() | ManagementEventWatcher() | Initializes a new instance of the ManagementEventWatcher class. For further initialization, set the properties on the object. This is the default constructor. |
![]() | ManagementEventWatcher(EventQuery^) | Initializes a new instance of the ManagementEventWatcher class when given a WMI event query. |
![]() | ManagementEventWatcher(ManagementScope^, EventQuery^) | Initializes a new instance of the ManagementEventWatcher class that listens for events conforming to the given WMI event query. |
![]() | ManagementEventWatcher(ManagementScope^, EventQuery^, EventWatcherOptions^) | Initializes a new instance of the ManagementEventWatcher class that listens for events conforming to the given WMI event query, according to the specified options. For this variant, the query and the scope are specified objects. The options object can specify options such as time-out and context information. |
![]() | ManagementEventWatcher(String^) | Initializes a new instance of the ManagementEventWatcher class when given a WMI event query in the form of a string. |
![]() | ManagementEventWatcher(String^, String^) | Initializes a new instance of the ManagementEventWatcher class that listens for events conforming to the given WMI event query. For this variant, the query and the scope are specified as strings. |
![]() | ManagementEventWatcher(String^, String^, EventWatcherOptions^) | Initializes a new instance of the ManagementEventWatcher class that listens for events conforming to the given WMI event query, according to the specified options. For this variant, the query and the scope are specified as strings. The options object can specify options such as a time-out and context information. |
| Name | Description | |
|---|---|---|
![]() | CanRaiseEvents | Gets a value indicating whether the component can raise an event.(Inherited from Component.) |
![]() | Container | Gets the IContainer that contains the Component.(Inherited from Component.) |
![]() | DesignMode | |
![]() | Events | |
![]() | Options | Gets or sets the options used to watch for events. |
![]() | Query | Gets or sets the criteria to apply to events. |
![]() | Scope | Gets or sets the scope in which to watch for events (namespace or scope). |
![]() | Site |
| Name | Description | |
|---|---|---|
![]() | CreateObjRef(Type^) | Creates an object that contains all the relevant information required to generate a proxy used to communicate with a remote object.(Inherited from MarshalByRefObject.) |
![]() | Dispose() | |
![]() | Dispose(Boolean) | |
![]() | Equals(Object^) | Determines whether the specified object is equal to the current object.(Inherited from Object.) |
![]() | Finalize() | Ensures that outstanding calls are cleared. This is the destructor for the object. In C#, finalizers are expressed using destructor syntax. (Overrides Component::Finalize().) |
![]() | GetHashCode() | Serves as the default hash function. (Inherited from Object.) |
![]() | GetLifetimeService() | Retrieves the current lifetime service object that controls the lifetime policy for this instance.(Inherited from MarshalByRefObject.) |
![]() | GetService(Type^) | |
![]() | GetType() | |
![]() | InitializeLifetimeService() | Obtains a lifetime service object to control the lifetime policy for this instance.(Inherited from MarshalByRefObject.) |
![]() | MemberwiseClone() | |
![]() | MemberwiseClone(Boolean) | Creates a shallow copy of the current MarshalByRefObject object.(Inherited from MarshalByRefObject.) |
![]() | Start() | Subscribes to events with the given query and delivers them, asynchronously, through the EventArrived event. |
![]() | Stop() | Cancels the subscription whether it is synchronous or asynchronous. |
![]() | ToString() | |
![]() | WaitForNextEvent() | Waits for the next event that matches the specified query to arrive, and then returns it. |
| Name | Description | |
|---|---|---|
![]() | Disposed | |
![]() | EventArrived | Occurs when a new event arrives. |
![]() | Stopped | Occurs when a subscription is canceled. |
The following example shows how the client receives notification when an instance of Win32_Process is created because the event class is __InstanceCreationEvent. For more information, see the Windows Management Instrumentation documentation in the MSDN Library at http://msdn.microsoft.com/library. The client receives events synchronously by calling the WaitForNextEvent method. This example can be tested by starting a process, such as Notepad, while the example code is running.
Available since 1.1
Any public static ( Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.




