IWbemServices::QueryObjectSink method (wbemcli.h)

The IWbemServices::QueryObjectSink method allows the caller to obtain a notification handler that is exported by Windows Management. This allows the caller to write notifications and events directly to Windows Management. The caller should only write extrinsic events to Windows Management. For more information, see Determining the Type of Event to Receive.


HRESULT QueryObjectSink(
  [in]  long            lFlags,
  [out] IWbemObjectSink **ppResponseHandler


[in] lFlags

Reserved. This parameter must be 0.

[out] ppResponseHandler

Receives the interface pointer to the notification handler. This is set to point to NULL when there is an error. The returned pointer has a positive reference count, and the caller must call IWbemServices::Release on the pointer when it is no longer needed. A NULL value can be returned if no notification handler is available. This is not an error.

Note  The value of the ppResponseHandler parameter cannot be NULL when it is passed to this method.

Return value

This method returns an HRESULT indicating the status of the method call. The following list lists the value contained within an HRESULT.

COM-specific error codes also may be returned if network problems cause you to lose the remote connection to Windows Management.

Note  Firing events using QueryObjectSink is permitted by default for Administrators only. Extending the permission to other users requires giving them WBEM_FULL_WRITE permission.


Requirement Value
Minimum supported client Windows Vista
Minimum supported server Windows Server 2008
Target Platform Windows
Header wbemcli.h (include Wbemidl.h)
Library Wbemuuid.lib
DLL Fastprox.dll; Esscli.dll; FrameDyn.dll; FrameDynOS.dll; Ntevt.dll; Stdprov.dll; Viewprov.dll; Wbemcomn.dll; Wbemcore.dll; Wbemess.dll; Wbemsvc.dll; Wmipicmp.dll; Wmidcprv.dll; Wmipjobj.dll; Wmiprvsd.dll

See also



Querying WMI