IWbemServices::ExecQueryAsync

[This is preliminary documentation and subject to change.]

The IWbemServices::ExecQueryAsync method performs the same task as IWbemServices::ExecQuery except that the result set is supplied to the specified response handler.

For the valid types of queries that can be performed, see Queries.

HRESULT IWbemServices::ExecQueryAsync(
  [in] BSTR bstrQueryLanguage,                
  [in] BSTR bstrQuery,                        
  [in] LONG lFlags,                       
  [in] IWbemContext *pCtx,              
  [in] CALLBACK *pResponseHandler  
);
 

Parameters

bstrQueryLanguage
A valid BSTR containing one of the query languages supported by CIMOM. This must be WQL.
bstrQuery
A valid BSTR containing the text of the query. This cannot be NULL.
lFlags
Reserved. It must be zero.
pCtx
Typically NULL. Otherwise, this is a pointer to an IWbemContext object required by the dynamic class provider that is producing the class instances. The values in the context object must be specified in the documentation for the provider in question.

If the query is very broad and involves many instance providers, it is not practical to include enough context information for all providers. In these cases, it is recommended that the parameter be NULL.

pResponseHandler
Points to the caller's implementation of IWbemObjectSink. This handler receives the objects in the query result set as they become available. CIMOM calls IWbemObjectSink::Indicate with the objects any number of times, followed by a single call to IWbemObjectSink::SetStatus to indicate the final status.

For a detailed explanation of this parameter, see Asynchronous Methods.

CIMOM only calls AddRef to the pointer in cases where WBEM_NO_ERROR is returned. In cases where an error code is returned, the reference count is the same as on entry.

Return Values

WBEM_E_FAILED Other unspecified errors.
WBEM_E_INVALID_CLASS The specified class was invalid.
WBEM_E_INVALID_PARAMETER An invalid parameter was specified or the namespace could not be parsed.
WBEM_E_OUT_OF_MEMORY There was not enough memory to complete the operation.
WBEM_E_TRANSPORT_FAILURE The communications link between the client and CIMOM has failed.
WBEM_NO_ERROR The call succeeded.

On failure, you can obtain any available information from the COM function GetErrorInfo.

Other error codes are returned to the object sink specified by the pResponseHandler parameter.

See Also

Asynchronous Methods, IWbemServices::ExecQuery, Queries