ManagementEventWatcher Class
Subscribes to temporary event notifications based on a specified event query.
System::MarshalByRefObject
System.ComponentModel::Component
System.Management::ManagementEventWatcher
Assembly: System.Management (in System.Management.dll)
The ManagementEventWatcher type exposes the following members.
| 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(String) | Initializes a new instance of the ManagementEventWatcher class when given a WMI event query in the form of a string. |
![]() | ManagementEventWatcher(ManagementScope, EventQuery) | Initializes a new instance of the ManagementEventWatcher class that listens for events conforming to the given WMI event query. |
![]() | 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(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, 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 | Gets a value that indicates whether the Component is currently in design mode. (Inherited from Component.) |
![]() | Events | Gets the list of event handlers that are attached to this Component. (Inherited from Component.) |
![]() | 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 | Gets or sets the ISite of the Component. (Inherited from Component.) |
| Name | Description | |
|---|---|---|
![]() | CreateObjRef | 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() | Releases all resources used by the Component. (Inherited from Component.) |
![]() | Dispose(Boolean) | Releases the unmanaged resources used by the Component and optionally releases the managed resources. (Inherited from Component.) |
![]() | 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 a hash function for a particular type. (Inherited from Object.) |
![]() | GetLifetimeService | Retrieves the current lifetime service object that controls the lifetime policy for this instance. (Inherited from MarshalByRefObject.) |
![]() | GetService | Returns an object that represents a service provided by the Component or by its Container. (Inherited from Component.) |
![]() | GetType | Gets the Type of the current instance. (Inherited from Object.) |
![]() | InitializeLifetimeService | Obtains a lifetime service object to control the lifetime policy for this instance. (Inherited from MarshalByRefObject.) |
![]() | MemberwiseClone() | Creates a shallow copy of the current Object. (Inherited from Object.) |
![]() | 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 | Returns a String containing the name of the Component, if any. This method should not be overridden. (Inherited from Component.) |
![]() | WaitForNextEvent | Waits for the next event that matches the specified query to arrive, and then returns it. |
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.
Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows XP SP2 x64 Edition, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.




