Microsoft DirectX 9.0

IDirectPlay8LobbiedApplication::Initialize Method

Registers a message handler function that receives notifications about changes in the state of the lobby client and receives messages from the lobby client.


HRESULT Initialize(      

    const PVOID pvUserContext,     const PFNDPNMESSAGEHANDLER pfn,     DPNHANDLE *const pdpnhConnection,     const DWORD dwFlags );


[in] Pointer to the user-provided context value in calls to the message handler. Providing a user-context value is useful to differentiate messages from multiple interfaces to a common message handler.
[in] Pointer to a PFNDPNMESSAGEHANDLER callback function that receives all messages from the IDirectPlay8LobbyClient interface and indications of session changes from the IDirectPlay8LobbiedApplication interface.
[out] Value used to detect if your application was lobby launched. If your application was lobby launched, this parameter will be set to the connection handle to the lobby client. If your process was not lobby launched, this parameter is set to NULL.
[in] The following flag can be specified.
Disables parameter validation.

Return Value

Returns S_OK if successful, or one of the following error values.

DPNERR_ALREADYINITIALIZEDThe object has already been initialized.
DPNERR_INVALIDFLAGSThe flags passed to this method are invalid.
DPNERR_INVALIDPARAMOne or more of the parameters passed to the method are invalid.
DPNERR_NOTALLOWEDThis function is not allowed on this object.


Call this method first after using CoCreateInstance to obtain the IDirectPlay8LobbiedApplication interface.

This method automatically establishes a connection to the lobby client if you were lobby launched. If you call IDirectPlay8LobbiedApplication::Initialize and you were lobby launched and the lobbied application interface is unable to contact the lobby client process, IDirectPlay8LobbiedApplication::Initialize will time out after four seconds. In this case, IDirectPlay8LobbiedApplication::Initialize will return DPNERR_TIMEDOUT but will still succeed.

Note  Only one instance of IDirectPlay8LobbyClient and IDirectPlay8LobbiedApplication is allowed to be running for each process.

© 2002 Microsoft Corporation. All rights reserved.