IWbemServices::QueryObjectSink method
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.
Syntax
HRESULT QueryObjectSink(
[in] LONG lFlags,
[out] IWbemObjectSink **ppResponseHandler
);
Parameters
- lFlags [in]
-
Reserved. This parameter must be 0.
- ppResponseHandler [out]
-
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 table 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.
| Return code | Description |
|---|---|
|
The caller does not have permission to provide notifications to Windows Management. |
|
This is an unspecified error. |
|
A specified parameter is not valid. |
|
There was not enough memory to complete the operation. |
|
Windows Management service was probably stopped and restarted. A new call to ConnectServer is needed. |
|
This indicates the failure of the remote procedure call (RPC) link between the current process and Windows Management. |
|
The call succeeded. |
Windows Server 2003 and Windows XP with SP1: Firing events using QueryObjectSink is permitted by default for Administrators only. Extending the permission to other users requires giving them WBEM_FULL_WRITE permission.
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 2000 Professional [desktop apps only] |
|---|---|
|
Minimum supported server | Windows 2000 Server [desktop apps only] |
|
Header |
|
|
Library |
|
|
DLL |
|
See also
Send comments about this topic to Microsoft
Build date: 11/19/2012