// -------------------------------------------------------------------------- // ========================================================================== // File: TDx9_PlayPeer.CPP // Authors: BCB_Code_Generator v2.00, // Darren Dwyer (source code, documentation, demos, website), // Hugh Edwards (documentation, icons) // Description: This file contains the code for the TDx9_PlayPeer Component // // "TDx9_Play_Library v1.00" // (c) 2005 BCB-Tools.com Pty. Ltd., Sydney, Australia. // All Rights Reserved. // // Refer to the 'Licence.Txt' file for licencing & copyright information. // ========================================================================== // -------------------------------------------------------------------------- // #includes ... // -------------------------------------------------------------------------- #include #pragma hdrstop // -------------------------------------------------------------------------- #include "TDx9_PlayPeer.H" // -------------------------------------------------------------------------- #pragma link "TDx_Library_Defns" #pragma link "TDx_Library_Functions" #pragma link "TDx9_Play_Library_Defns" #pragma link "TDx9_Play_Library_Functions" // -------------------------------------------------------------------------- // Object Registration... // -------------------------------------------------------------------------- #if (__BORLANDC__ >= 0x0530) // BCB Version 3+ #pragma package(smart_init) #endif // -------------------------------------------------------------------------- static inline void ValidCtrCheck(TDx9_PlayPeer*) { new TDx9_PlayPeer(NULL); } // -------------------------------------------------------------------------- namespace Tdx9_playpeer { #if (__BORLANDC__ >= 0x0530) // BCB Version 3+ void __fastcall PACKAGE Register() #else void __fastcall Register() #endif { TComponentClass classes[1] = {__classid(TDx9_PlayPeer)}; RegisterComponents("", classes, 0); } } // -------------------------------------------------------------------------- // Constructor: TDx9_PlayPeer::TDx9_PlayPeer() // Description: The default constructor for the TDx9_PlayPeer object. // -------------------------------------------------------------------------- __fastcall TDx9_PlayPeer::TDx9_PlayPeer(TComponent* Owner) : TComponent(Owner) { fErrorValue = ; fCreated = false; } // -------------------------------------------------------------------------- // Destructor: TDx9_PlayPeer::~TDx9_PlayPeer() // Description: The destructor for the TDx9_PlayPeer object. // -------------------------------------------------------------------------- __fastcall TDx9_PlayPeer::~TDx9_PlayPeer() { // destroy internals if (Created) Destroy(); } // -------------------------------------------------------------------------- // Property: Created // Description: The Created property is true if the internal // LPIDIRECTPLAY8PEER used in this component has been // successfully created, otherwise Created is false. // // To create the internal LPIDIRECTPLAY8PEER, call the // TDx9_PlayPeer::Create() method. // -------------------------------------------------------------------------- bool __fastcall TDx9_PlayPeer::FGetCreated() { return fCreated; } // -------------------------------------------------------------------------- void __fastcall TDx9_PlayPeer::FSetCreated( bool pCreated ) { fCreated = (pCreated && (fLPIDIRECTPLAY8PEER==NULL)); } // -------------------------------------------------------------------------- // Property: ErrorValue // Description: The ErrorValue property contains the last error value // returned from a call to a TDx9_PlayPeer method or fget/fset. // eg. or DDERR_SURFACELOST or TDX_ERROR // -------------------------------------------------------------------------- HRESULT __fastcall TDx9_PlayPeer::FGetErrorValue() { return fErrorValue; } // -------------------------------------------------------------------------- void __fastcall TDx9_PlayPeer::FSetErrorValue( HRESULT pErrorValue ) { fErrorValue = pErrorValue; } // -------------------------------------------------------------------------- // Method: AddPlayerToGroup() // Description: The AddPlayerToGroup method is used to ... // Params: pDPNID - // The DPNID parameter ... // pconst - // The const parameter ... // p*const - // The *const parameter ... // pDWORD - // The DWORD parameter ... // -------------------------------------------------------------------------- // -------------------------------------------------------------------------- // Method: CancelAsyncOperation() // Description: The CancelAsyncOperation method is used to ... // Params: pDPNHANDLE - // The DPNHANDLE parameter ... // pDWORD - // The DWORD parameter ... // -------------------------------------------------------------------------- // -------------------------------------------------------------------------- // Method: Close() // Description: The Close method is used to ... // Params: pDWORD - // The DWORD parameter ... // -------------------------------------------------------------------------- // -------------------------------------------------------------------------- // Method: Connect() // Description: The Connect method is used to ... // Params: pDPN_APPLICATION_DESC - // The DPN_APPLICATION_DESC parameter ... // p*const - // The *const parameter ... // pDPN_SECURITY_DESC - // The DPN_SECURITY_DESC parameter ... // pDPN_SECURITY_CREDENTIALS - // The DPN_SECURITY_CREDENTIALS parameter ... // pvoid - // The void parameter ... // pDWORD - // The DWORD parameter ... // -------------------------------------------------------------------------- // -------------------------------------------------------------------------- // Method: Create() // Description: The Create() method is used to automatically create the // internal LPIDIRECTPLAY8PEER interface used in the // TDx9_PlayPeer component and must be called before any methods // of the TDx9_PlayPeer component will function. // -------------------------------------------------------------------------- bool __fastcall TDx9_PlayPeer::Create() { fCreated = true; if (fCreated && FOnCreate) FOnCreate(this); return fCreated; } // -------------------------------------------------------------------------- // Method: CreateGroup() // Description: The CreateGroup method is used to ... // Params: pDPN_GROUP_INFO - // The DPN_GROUP_INFO parameter ... // p*const - // The *const parameter ... // pDWORD - // The DWORD parameter ... // -------------------------------------------------------------------------- // -------------------------------------------------------------------------- // Method: Destroy() // Description: The Destroy() method is used to automatically destroy the // internal LPIDIRECTPLAY8PEER interface used in the // TDx9_PlayPeer component and should be called when the // internal interface is no longer required. // // Note: This method is called by the component's destructor. // -------------------------------------------------------------------------- bool __fastcall TDx9_PlayPeer::Destroy() { fCreated = false; if (FOnDestroy) FOnDestroy(this); return !fCreated; } // -------------------------------------------------------------------------- // Method: DestroyGroup() // Description: The DestroyGroup method is used to ... // Params: pDPNID - // The DPNID parameter ... // pconst - // The const parameter ... // p*const - // The *const parameter ... // pDWORD - // The DWORD parameter ... // -------------------------------------------------------------------------- // -------------------------------------------------------------------------- // Method: DestroyPeer() // Description: The DestroyPeer method is used to ... // Params: pDPNID - // The DPNID parameter ... // p*const - // The *const parameter ... // pDWORD - // The DWORD parameter ... // -------------------------------------------------------------------------- // -------------------------------------------------------------------------- // Method: EnumGroupMembers() // Description: The EnumGroupMembers method is used to ... // Params: pDPNID - // The DPNID parameter ... // p*const - // The *const parameter ... // pDWORD - // The DWORD parameter ... // -------------------------------------------------------------------------- // -------------------------------------------------------------------------- // Method: EnumHosts() // Description: The EnumHosts method is used to ... // Params: pconst - // The const parameter ... // p*const - // The *const parameter ... // pDWORD - // The DWORD parameter ... // -------------------------------------------------------------------------- // -------------------------------------------------------------------------- // Method: EnumPlayersAndGroups() // Description: The EnumPlayersAndGroups method is used to ... // Params: p*const - // The *const parameter ... // pDWORD - // The DWORD parameter ... // -------------------------------------------------------------------------- // -------------------------------------------------------------------------- // Method: EnumServiceProviders() // Description: The EnumServiceProviders method is used to ... // Params: pGUID - // The GUID parameter ... // pDPN_SERVICE_PROVIDER_INFO - // The DPN_SERVICE_PROVIDER_INFO parameter ... // p*const - // The *const parameter ... // pDWORD - // The DWORD parameter ... // -------------------------------------------------------------------------- // -------------------------------------------------------------------------- // Method: GetApplicationDesc() // Description: The GetApplicationDesc method is used to ... // Params: p*const - // The *const parameter ... // pDWORD - // The DWORD parameter ... // -------------------------------------------------------------------------- // -------------------------------------------------------------------------- // Method: GetCaps() // Description: The GetCaps method is used to ... // Params: p*const - // The *const parameter ... // pDWORD - // The DWORD parameter ... // -------------------------------------------------------------------------- // -------------------------------------------------------------------------- // Method: GetConnectionInfo() // Description: The GetConnectionInfo method is used to ... // Params: pDPNID - // The DPNID parameter ... // p*const - // The *const parameter ... // pDWORD - // The DWORD parameter ... // -------------------------------------------------------------------------- // -------------------------------------------------------------------------- // Method: GetGroupContext() // Description: The GetGroupContext method is used to ... // Params: pDPNID - // The DPNID parameter ... // p*const - // The *const parameter ... // pDWORD - // The DWORD parameter ... // -------------------------------------------------------------------------- // -------------------------------------------------------------------------- // Method: GetGroupInfo() // Description: The GetGroupInfo method is used to ... // Params: pDPNID - // The DPNID parameter ... // p*const - // The *const parameter ... // pDWORD - // The DWORD parameter ... // -------------------------------------------------------------------------- // -------------------------------------------------------------------------- // Method: GetLocalHostAddresses() // Description: The GetLocalHostAddresses method is used to ... // Params: p**const - // The **const parameter ... // p*const - // The *const parameter ... // pDWORD - // The DWORD parameter ... // -------------------------------------------------------------------------- // -------------------------------------------------------------------------- // Method: GetPeerAddress() // Description: The GetPeerAddress method is used to ... // Params: pDPNID - // The DPNID parameter ... // p**const - // The **const parameter ... // pDWORD - // The DWORD parameter ... // -------------------------------------------------------------------------- // -------------------------------------------------------------------------- // Method: GetPeerInfo() // Description: The GetPeerInfo method is used to ... // Params: pDPNID - // The DPNID parameter ... // p*const - // The *const parameter ... // pDWORD - // The DWORD parameter ... // -------------------------------------------------------------------------- // -------------------------------------------------------------------------- // Method: GetPlayerContext() // Description: The GetPlayerContext method is used to ... // Params: pDPNID - // The DPNID parameter ... // p*const - // The *const parameter ... // pDWORD - // The DWORD parameter ... // -------------------------------------------------------------------------- // -------------------------------------------------------------------------- // Method: GetSPCaps() // Description: The GetSPCaps method is used to ... // Params: pGUID - // The GUID parameter ... // p*const - // The *const parameter ... // pDWORD - // The DWORD parameter ... // -------------------------------------------------------------------------- // -------------------------------------------------------------------------- // Method: GetSendQueueInfo() // Description: The GetSendQueueInfo method is used to ... // Params: pDPNID - // The DPNID parameter ... // p*const - // The *const parameter ... // pDWORD - // The DWORD parameter ... // -------------------------------------------------------------------------- // -------------------------------------------------------------------------- // Method: Host() // Description: The Host method is used to ... // Params: pDPN_APPLICATION_DESC - // The DPN_APPLICATION_DESC parameter ... // p**const - // The **const parameter ... // pDWORD - // The DWORD parameter ... // pDPN_SECURITY_DESC - // The DPN_SECURITY_DESC parameter ... // pDPN_SECURITY_CREDENTIALS - // The DPN_SECURITY_CREDENTIALS parameter ... // p*const - // The *const parameter ... // -------------------------------------------------------------------------- // -------------------------------------------------------------------------- // Method: Initialize() // Description: The Initialize method is used to ... // Params: pconst - // The const parameter ... // pPFNDPNMESSAGEHANDLER - // The PFNDPNMESSAGEHANDLER parameter ... // pDWORD - // The DWORD parameter ... // -------------------------------------------------------------------------- // -------------------------------------------------------------------------- // Method: RegisterLobby() // Description: The RegisterLobby method is used to ... // Params: pDPNHANDLE - // The DPNHANDLE parameter ... // p*const - // The *const parameter ... // pDWORD - // The DWORD parameter ... // -------------------------------------------------------------------------- // -------------------------------------------------------------------------- // Method: RemovePlayerFromGroup() // Description: The RemovePlayerFromGroup method is used to ... // Params: pDPNID - // The DPNID parameter ... // pconst - // The const parameter ... // p*const - // The *const parameter ... // pDWORD - // The DWORD parameter ... // -------------------------------------------------------------------------- // -------------------------------------------------------------------------- // Method: ReturnBuffer() // Description: The ReturnBuffer method is used to ... // Params: pDPNHANDLE - // The DPNHANDLE parameter ... // pDWORD - // The DWORD parameter ... // -------------------------------------------------------------------------- // -------------------------------------------------------------------------- // Method: SendTo() // Description: The SendTo method is used to ... // Params: pDPNID - // The DPNID parameter ... // pDPN_BUFFER_DESC - // The DPN_BUFFER_DESC parameter ... // pDWORD - // The DWORD parameter ... // p*const - // The *const parameter ... // -------------------------------------------------------------------------- // -------------------------------------------------------------------------- // Method: SetApplicationDesc() // Description: The SetApplicationDesc method is used to ... // Params: pDPN_APPLICATION_DESC - // The DPN_APPLICATION_DESC parameter ... // pDWORD - // The DWORD parameter ... // -------------------------------------------------------------------------- // -------------------------------------------------------------------------- // Method: SetCaps() // Description: The SetCaps method is used to ... // Params: pDPN_CAPS - // The DPN_CAPS parameter ... // pDWORD - // The DWORD parameter ... // -------------------------------------------------------------------------- // -------------------------------------------------------------------------- // Method: SetGroupInfo() // Description: The SetGroupInfo method is used to ... // Params: pDPNID - // The DPNID parameter ... // p*const - // The *const parameter ... // pconst - // The const parameter ... // pDWORD - // The DWORD parameter ... // -------------------------------------------------------------------------- // -------------------------------------------------------------------------- // Method: SetPeerInfo() // Description: The SetPeerInfo method is used to ... // Params: pDPN_PLAYER_INFO - // The DPN_PLAYER_INFO parameter ... // pconst - // The const parameter ... // p*const - // The *const parameter ... // pDWORD - // The DWORD parameter ... // -------------------------------------------------------------------------- // -------------------------------------------------------------------------- // Method: SetSPCaps() // Description: The SetSPCaps method is used to ... // Params: pGUID - // The GUID parameter ... // pDPN_SP_CAPS - // The DPN_SP_CAPS parameter ... // pDWORD - // The DWORD parameter ... // -------------------------------------------------------------------------- // -------------------------------------------------------------------------- // Method: TerminateSession() // Description: The TerminateSession method is used to ... // Params: p*const - // The *const parameter ... // pDWORD - // The DWORD parameter ... // -------------------------------------------------------------------------- // -------------------------------------------------------------------------- // Internal Interface Access // -------------------------------------------------------------------------- LPIDIRECTPLAY8PEER __fastcall TDx9_PlayPeer::FGetInternal_LPIDIRECTPLAY8PEER() { return fLPIDIRECTPLAY8PEER; } // -------------------------------------------------------------------------- LPIDIRECTPLAY8PEER* __fastcall TDx9_PlayPeer::FGetInternal_LPIDIRECTPLAY8PEER_Ptr() { return &fLPIDIRECTPLAY8PEER; } // -------------------------------------------------------------------------- void __fastcall TDx9_PlayPeer::FSetInternal_LPIDIRECTPLAY8PEER( LPIDIRECTPLAY8PEER pLPIDIRECTPLAY8PEER ) { if (!fCreated) { fLPIDIRECTPLAY8PEER = pLPIDIRECTPLAY8PEER; fCreated = (fLPIDIRECTPLAY8PEER!=NULL); } } // -------------------------------------------------------------------------- void __fastcall TDx9_PlayPeer::Internal_LPIDIRECTPLAY8PEER_Update() { fCreated = (fLPIDIRECTPLAY8PEER!=NULL); } // --------------------------------------------------------------------------