Редактиране

Споделяне чрез


Receiving Events for the Duration of Your Application

One of the most common ways to receive an event is through a running application, such as a management application that collects and displays events to a user. Such applications are called "temporary" because a temporary consumer does not receive event notifications when shut down.

A temporary consumer calls SWbemServices.ExecNotificationQuery in script or IWbemServices.ExecNotificationQuery in C++ to subscribe to events in a namespace. The identity associated with this subscription is the caller.

A temporary event consumer can receive notifications either asynchronously or semisynchronously in both scripts and C++.

Note

For security reasons, it is important to note that asynchronous event notifications are not recommended. For more information, see Setting Security on an Asynchronous Call. Event consumers have special security concerns. For more information, see Securing WMI Events.

 

For more information about receiving asynchronous and semisynchronous event notifications, see Receiving Asynchronous Event Notifications and Receiving Semisynchronous Event Notifications.