DirectX SDK

DirectPlayLobby3.RunApplication

The DirectPlayLobby3.RunApplication method starts an application and passes to it all the information necessary to connect it to a session. This method is used by a lobby client.

object.RunApplication( _
    connection As DirectPlayLobbyConnection, _
    receiveEvent As Long) As Long

Parameters

object
Object expression that resolves to a DirectPlayLobby3 object.
connection
DirectPlayLobbyConnection interface that contains all the information necessary to specify which application to start and how to get it connected to a session instance without displaying any user dialog boxes.
receiveEvent
Handle to a synchronization event that will be set when a lobby message is received. This event can be changed later by using the DirectPlayLobby3.SetLobbyMessageEvent method.

Return Values

The method returns an ID for the application that was started. The lobby client must save this application ID for use in any calls to the DirectPlayLobby3.SendLobbyMessage and DirectPlayLobby3.ReceiveLobbyMessage methods.

Error Codes

If the method fails, an error is raised and Err.Number may be set to one of the following values:

DPERR_CANTCREATEPROCESS
DPERR_GENERIC
DPERR_INVALIDINTERFACE
DPERR_INVALIDOBJECT
DPERR_INVALIDPARAMS
DPERR_OUTOFMEMORY
DPERR_UNKNOWNAPPLICATION

Remarks

This method will return after the application process has been created. The lobby client will receive a system message indicating the status of the application. If the lobby client is starting an application that will host a session, it should wait until it receives a DPLSYS_DPLAYCONNECTSUCCEEDED system message before starting the other applications that will join the session. If the application was unable to create or join a session, a DPLSYS_DPLAYCONNECTFAILED message will be generated. The lobby client will also receive a DPLSYS_CONNECTIONSETTINGSREAD system message when the application has read the connection settings and a DPLSYS_APPTERMINATED system message when the application terminates.

It is important that the lobby client not release the DirectPlayLobby3 object before it receives a DPLSYS_CONNECTIONSETTINGSREAD system message. The lobby client can either check ReceiveLobbyMessage in a loop until it is received, or supply a synchronization event.

See Also

DirectPlayLobby3.GetConnectionSettings, DirectX7.CreateEvent