Microsoft DirectX 8.1 (Visual Basic)

DirectPlay8Client.CancelAsyncOperation

Cancels asynchronous requests. Many methods of the DirectPlay8Client class run asynchronously by default. Depending on the situation, you might want to cancel requests before they are processed. All the methods of this class that can be run asynchronously return an lAsyncHandle parameter.

Specific requests are canceled by passing the lAsyncHandle of the request in this method's lAsyncHandle parameter. You can cancel all pending asynchronous operations by calling this method, passing 0 in the lAsyncHandle parameter, and specifying DPNCANCEL_ALL_OPERATIONS in the lFlags parameter. If a specific handle is provided to this method, you must pass 0 in the lFlags parameter.

CancelAsyncOperation(lAsyncHandle As Long, _
    [lFlags As CONST_DPNCANCELFLAGS])

Parts

lAsyncHandle
Handle of the asynchronous operation to stop. This value can be 0 to stop all requests or a particular type of asynchronous request. If a specific handle for the request to cancel is specified, the lFlags parameter must be 0.
lFlags
Flag that specifies which asynchronous request to cancel. You can set this parameter to one of the flags of the CONST_DPNCANCELFLAGS enumeration.

Error Codes

If the method fails, Err.Number can be set to one of the following values.

DPNERR_PENDING
DPNERR_INVALIDFLAGS
DPNERR_CANNOTCANCEL
DPNERR_INVALIDHANDLE

Remarks

You can cancel a send by providing the handle returned from DirectPlay8Client.Send method. The DirectPlay8Event.SendComplete method will still be called unless the message was sent with the DPNSEND_NOCOMPLETE flag set. If you cancel a send operation by calling DirectPlay8Peer.CancelAsyncOperation the hResultCode member of the DPNMSG_SEND_COMPLETE type that is passed to the DirectPlay8Event.SendComplete method will be set to DPNERR_CANCELLED.