Microsoft DirectX 8.1 (Visual Basic) |
Establishes the connection to the server. Once a connection is established, the communication channel on the interface is open and active and the application should expect messages to arrive immediately. No messages can be sent by means of the DirectPlay8Client.Send method until the connection has completed.
Before this method is called, you can obtain an application description by calling DirectPlay8Client.EnumHosts. The EnumHosts method returns a DPN_APPLICATION_DESC type for each hosted application. The type describes the application, including the GUID of the application.
When the connection to the host is requested, the DirectPlay8Event.IndicateConnect method is called in the host's message handler. The host may either accept or reject the connection. In either case, once the host has acted, the client message handler's DirectPlay8Event.ConnectComplete method will be called to convey the response.
Connect(AppDesc As DPN_APPLICATION_DESC, _ Address As DirectPlay8Address, _ DeviceInfo As DirectPlay8Address, _ lFlags As CONST_DPNOPERATIONS, _ UserData As Any, _ UserDataSize As Long) As Long
Process the connection request synchronously. Setting this flag does not generate a DirectPlay8Event.ConnectComplete method call.
Returns the asynchronous handle for this operation. This is the handle that is used in lAsyncHandle parameter of the DirectPlay8Client.CancelAsyncOperation method to cancel the request, if the request is processed asynchronously.
If the method fails, Err.Number can be set to one of the following values.
DPNERR_NOCONNECTION |
DPNERR_INVALIDPASSWORD |
DPNERR_INVALIDFLAGS |
DPNERR_INVALIDINTERFACE |
DPNERR_INVALIDAPPLICATION |
DPNERR_NOTHOST |
DPNERR_SESSIONFULL |
DPNERR_HOSTREJECTEDCONNECTION |
DPNERR_INVALIDINSTANCE |
Although multiple enumerations can be run concurrently, and can be run across the duration of a connection, only one connection is allowed per object. To establish a connection to more than one application, you must create another object. That is, only one running application per object is allowed. If DirectPlay8Client.Connect is called while another connection is in progress, the method raises an error.
After a call to DirectPlay8Client.Connect succeeds, all outstanding enumerations are canceled with the DPNERR_USERCANCEL error value set.