Microsoft DirectX 8.1 (Visual Basic) |
Cancels asynchronous requests. Many methods of the DirectPlay8Peer 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)
If the method fails, Err.Number can be set to one of the following values.
DPNERR_PENDING |
DPNERR_INVALIDFLAGS |
DPNERR_CANNOTCANCEL |
DPNERR_INVALIDHANDLE |
You can cancel a send by providing the handle returned from DirectPlay8Peer.SendTo 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.