The IWbemServices::DeleteInstanceAsync method asynchronously deletes an instance of an existing class in the current namespace. The confirmation or failure of the operation is reported through the IWbemObjectSink interface implemented by the caller.
HRESULT DeleteInstanceAsync( const BSTR strObjectPath, long lFlags, IWbemContext *pCtx, IWbemObjectSink *pResponseHandler );
Valid BSTR that contains the object path of the object to be deleted.
WBEM_FLAG_SEND_STATUS registers with Windows Management a request to receive intermediate status reports through the client's implementation of IWbemObjectSink::SetStatus. Provider implementation must support intermediate status reporting, for this flag to change behavior. Note that the WBEM_FLAG_USE_AMENDED_QUALIFIERS flag cannot be used here.
Typically NULL. Otherwise, this is a pointer to an IWbemContext object that may be used by the provider that is deleting the instance. The values in the context object must be specified in the documentation for the provider in question.
Pointer to the caller's implementation of IWbemObjectSink. This handler receives the status of the delete operation as it becomes available through the SetStatus method. If any error code is returned, then the supplied IWbemObjectSink pointer is not used. If WBEM_S_NO_ERROR is returned, then the user's IWbemObjectSink implementation is called to indicate the result of the operation. Windows Management only calls AddRef on the pointer in cases where WBEM_S_NO_ERROR returns. In cases where an error code returns, the reference count is the same as on entry. For more information, see Calling a Method.
This method returns an HRESULT that indicates the status of the method call. The following list lists the value contained withinan HRESULT.
On failure, you can obtain any available information from the COM function GetErrorInfo.
If DeleteInstanceAsync returns WBEM_S_NO_ERROR, WMI waits for a result from the SetStatus method of the response handler. WMI waits indefinitely on a local connection, or until a remote connection time-out occurs.
Other error conditions are reported asynchronously to the object sink supplied by the pResponseHandler parameter.
COM-specific error codes also may be returned if network problems cause you to lose the remote connection to Windows Management.
An instance provider can report success or failure with either the return code from DeleteInstanceAsync or through a call to SetStatus made through pResponseHandler. If sent to SetStatus, the return code sent to the sink through pResponseHandler takes precedence. Because the callback might not be returned at the same authentication level as the client requires, it is recommended that you use semisynchronous instead of asynchronous communication. If you require asynchronous communication, see Calling a Method.
|Minimum supported client||Windows Vista|
|Minimum supported server||Windows Server 2008|
|Header||wbemcli.h (include Wbemidl.h)|
|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|