Export (0) Print
Expand All

IWbemObjectSink::Indicate method

The Indicate method is called by a source to provide a notification. Typically, WMI calls the client implementation of this interface after the client executes one of the asynchronous methods of IWbemServices. In other cases, various types of providers call an implementation exported by WMI to deliver events. Therefore, client code may have to implement this interface in some cases, and use a different component's implementation in other cases.

Use this interface and method in conjunction with the asynchronous methods of the IWbemServices interface.

Clients and providers must implement this interface to receive notifications or to execute the asynchronous methods of IWbemServices. For more information, see Calling a Method.

Syntax


HRESULT Indicate(
  [in]  LONG lObjectCount,
  [in]  IWbemClassObject **ppObjArray
);

Parameters

lObjectCount [in]

Number of objects in the following array of pointers.

ppObjArray [in]

Array of pointers to IWbemClassObject interfaces. The array memory itself is read-only, and is owned by the caller of the method. Because this is an in parameter, the implementation has the option of calling IWbemClassObject::AddRef on any object pointer in the array and holding it before returning if the objects will be used after the method has returned, in accordance with COM rules. If the objects are only used for the duration of the Indicate call, then you do not need to call AddRef on each object pointer.

Return value

This method returns an HRESULT that indicates the status of the method call. The following table lists the value contained within an HRESULT.

Return codeDescription
WBEM_E_FAILED

The receiver was not able to process the notification properly.

WBEM_E_CALL_CANCELLED

The operation has been canceled and the provider should stop executing it.

WBEM_E_INVALID_PARAMETER

An invalid parameter was specified, such as a NULL ppObjArray pointer.

WBEM_S_NO_ERROR

The call succeeded; the receiver acknowledges the notification.

 

Remarks

When implementing an event subscription sink (IWbemObjectSink or IWbemEventSink), do not call into WMI from within the Indicate method on the sink object. For example, calling IWbemServices::CancelAsyncCall from within an implementation of Indicate can interfere with the WMI state. To cancel an event subscription, set a flag and call IWbemServices::CancelAsyncCall from another thread or object. For implementations that are not related to an event sink, such as object, enum, and query retrievals, you can call back into WMI.

Sink implementations should process the event notification within 100 MSEC because the WMI thread that delivers the event notification cannot do other work until the sink object has completed processing. If the notification requires a large amount of processing, the sink can use an internal queue for another thread to handle the processing.

When an event provider calls Indicate to provide an event, the call can fail with WBEM_E_SERVER_TOO_BUSY. The provider can choose to respond to this message by re-firing the event.

Note  Because the callback to the sink might not be returned at the same authentication level as the client requires, it is recommended that you use semisynchronous instead of asynchronous communication. For more information, see Calling a Method.

Examples

For script code examples, see WMI Tasks for Scripts and Applications and the TechNet ScriptCenter Script Repository.

For C++ code examples, see WMI C++ Application Examples.

Requirements

Minimum supported client

Windows XP

Minimum supported server

Windows Server 2003

Header

Wbemcli.h (include Wbemidl.h)

Library

Wbemuuid.lib

DLL

Fastprox.dll

See also

IWbemObjectSink
IWbemServices::ExecQueryAsync
IWbemObjectSink::SetStatus

 

 

Show:
© 2014 Microsoft