Bewerken

Share via


ISWbemSink::Cancel method

The Cancel method of the SWbemSink object cancels all outstanding asynchronous operations that are associated with this object sink.

For an explanation of this syntax, see Document Conventions for the Scripting API.

Syntax

SWbemSink.Cancel()

Parameters

This method has no parameters.

Return value

This method does not return a value.

Error codes

After the completion of the Cancel method, the Err object may contain one of the error codes below.

wbemErrFailed - 2147749889 (0x80041001)

Unspecified error.

wbemErrOutOfMemory - 2147749894 (0x80041006)

Not enough memory to complete the operation.

wbemErrTransportFailure - 2147749909 (0x80041015)

Networking error occurred, preventing normal operation.

wbemErrAccessDenied - 2147749891 (0x80041003)

Current or specified user name and password are not valid or authorized to make the connection.

Remarks

You cannot cancel only one asynchronous call. If multiple asynchronous calls are pending that use this object sink, then this method cancels all the asynchronous calls using this object sink. Asynchronous calls that are associated with other object sinks continue unaffected.

You cannot assign this sink to Nothing to cancel an asynchronous operation. You must call the Cancel method to make WMI discontinue the operation and free the associated resources. This is very important with lengthy asynchronous operations, such as queries, or operations that never complete, such as ExecNotificationQueryAsync.

Note

An asynchronous callback allows a non-authenticated user to provide data to the sink. This poses security risks to your scripts and applications. To eliminate the risks, use semisynchronous or synchronous communication. For more information, see Calling a Method.

The following example shows you how to cancel an asynchronous call.

objwbemsink.Cancel()
set objwbemsink= Nothing

Requirements

Requirement Value
Minimum supported client
Windows Vista
Minimum supported server
Windows Server 2008
Header
Wbemdisp.h
IDL
Wbemdisp.idl
DLL
Wbemdisp.dll
CLSID
CLSID_SWbemSink
IID
IID_ISWbemSink

See also

SWbemSink