⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 directplay8.pas

📁 雷神之锤2(Quake2)Delphi源码
💻 PAS
📖 第 1 页 / 共 5 页
字号:
    pUnknown: IUnknown): HResult; stdcall;
{$ENDIF}



(*==========================================================================
 *
 *  Copyright (C) 2000 Microsoft Corporation.  All Rights Reserved.
 *
 *  File:       DPLobby8.h
 *  Content:    DirectPlay8 Lobby Include File
 *
 ***************************************************************************)


(****************************************************************************
 *
 * DirectPlay8 Lobby Message IDs
 *
 ****************************************************************************)
const
  DPL_MSGID_LOBBY			= $8000;
  DPL_MSGID_RECEIVE			= $0001 or DPL_MSGID_LOBBY;
  DPL_MSGID_CONNECT			= $0002 or DPL_MSGID_LOBBY;
  DPL_MSGID_DISCONNECT			= $0003 or DPL_MSGID_LOBBY;
  DPL_MSGID_SESSION_STATUS	        = $0004 or DPL_MSGID_LOBBY;
  DPL_MSGID_CONNECTION_SETTINGS         = $0005 or DPL_MSGID_LOBBY;

(****************************************************************************
 *
 * DirectPlay8Lobby Constants
 *
 ****************************************************************************)

//
// Specifies that operation should be performed on all open connections
//
  DPLHANDLE_ALLCONNECTIONS	   	= $FFFFFFFF;

//
// The associated game session has suceeded in connecting / hosting
//
  DPLSESSION_CONNECTED		      	= $0001;

// The associated game session failed connecting / hosting
//
  DPLSESSION_COULDNOTCONNECT	  	= $0002;

//
// The associated game session has disconnected
//
  DPLSESSION_DISCONNECTED	        = $0003;

//
// The associated game session has terminated 
//
  DPLSESSION_TERMINATED		       	= $0004;

//
// The associated game session's host has migrated 
//
  DPLSESSION_HOSTMIGRATED	 	= $0005;

//
// The associated game session's host has migrated to the local client
//
  DPLSESSION_HOSTMIGRATEDHERE	  	= $0006;


(****************************************************************************
 *
 * DirectPlay8 Lobby Flags
 *
 ****************************************************************************)

//
// Do not automatically make the lobby app unavailable when a connection is established
//
  DPLAVAILABLE_ALLOWMULTIPLECONNECT     = $0001;

//
// Launch a new instance of the application to connect to
//
  DPLCONNECT_LAUNCHNEW		      	= $0001;

// 
// Launch a new instance of the application if one is not waiting
//
  DPLCONNECT_LAUNCHNOTFOUND	        = $0002;

//
// When starting the associated game session, start it as a host
//
  DPLCONNECTSETTINGS_HOST               = $0001;

// 
// Disable parameter validation
//
  DPLINITIALIZE_DISABLEPARAMVAL		= $0001;

(****************************************************************************
 *
 * DirectPlay8Lobby Structures (Non-Message)
 *
 ****************************************************************************)

type
//
// Information on a registered game
//
  PDPL_Application_Info = ^TDPL_Application_Info;
  TDPL_Application_Info = packed record
    guidApplication     : TGUID;         // GUID of the application
    pwszApplicationName : PWChar;        // Name of the application
    dwNumRunning        : DWORD;         // # of instances of this application running
    dwNumWaiting        : DWORD;         // # of instances of this application waiting
    dwFlags             : DWORD;         // Flags
  end;

//
// Application description
//
  PDPN_Application_Desc = ^TDPN_Application_Desc;
  TDPN_Application_Desc = packed record
    dwSize                        : DWORD;	// Size of this structure
    dwFlags                       : DWORD;	// Flags (DPNSESSION_...)
    guidInstance                  : TGUID;      // Instance GUID
    guidApplication               : TGUID;      // Application GUID
    dwMaxPlayers                  : DWORD;	// Maximum # of players allowed (0=no limit)
    dwCurrentPlayers              : DWORD;	// Current # of players allowed
    pwszSessionName               : PWChar;	// Name of the session
    pwszPassword                  : PWChar;	// Password for the session
    pvReservedData                : Pointer;
    dwReservedDataSize            : DWORD;
    pvApplicationReservedData     : Pointer;
    dwApplicationReservedDataSize : DWORD;
  end;

//
// Settings to be used for connecting / hosting a game session
//
  PDPL_Connection_Settings = ^TDPL_Connection_Settings;
  TDPL_Connection_Settings = packed record
    dwSize               : DWORD;                   // Size of this structure
    dwFlags              : DWORD;                   // Connection settings flags (DPLCONNECTSETTINGS_...)
    dpnAppDesc           : TDPN_Application_Desc;   // Application desc for the associated DirectPlay session
    pdp8HostAddress      : IDirectPlay8Address;     // Address of host to connect to
    ppdp8DeviceAddresses : PIDirectPlay8Addresses;  // Address of device to connect from / host on
    cNumDeviceAddresses  : DWORD;                   // # of addresses specified in ppdp8DeviceAddresses
    pwszPlayerName       : PWChar;                  // Name to give the player
  end;

//
// Information for performing a lobby connect
// (ConnectApplication)
//
  PDPL_Connect_Info = ^TDPL_Connect_Info;
  TDPL_Connect_Info = packed record
    dwSize                 : DWORD;                      // Size of this structure
    dwFlags                : DWORD;                      // Flags (DPLCONNECT_...)
    guidApplication        : TGUID;                      // GUID of application to launch
    pdplConnectionSettings : PDPL_Connection_Settings;   // Settings application should use
    pvLobbyConnectData     : Pointer;                    // User defined data block
    dwLobbyConnectDataSize : DWORD;                      // Size of user defined data block
  end;

//
// Information for registering an application
// (RegisterApplication)
//
  PDPL_Program_Desc = ^TDPL_Program_Desc;
  TDPL_Program_Desc = packed record
    dwSize                 : DWORD;
    dwFlags                : DWORD;
    guidApplication        : TGUID;          // Application GUID
    pwszApplicationName    : PWChar;         // Unicode application name
    pwszCommandLine        : PWChar;         // Unicode command line arguments
    pwszCurrentDirectory   : PWChar;         // Unicode current directory
    pwszDescription        : PWChar;	     // Unicode application description
    pwszExecutableFilename : PWChar;	     // Unicode filename of application executable
    pwszExecutablePath     : PWChar;	     // Unicode path of application executable
    pwszLauncherFilename   : PWChar;	     // Unicode filename of launcher executable
    pwszLauncherPath       : PWChar;	     // Unicode path of launcher executable
  end;

(****************************************************************************
 *
 * DirectPlay8 Lobby Message Structures
 *
 ****************************************************************************)

//
// A connection was established 
// (DPL_MSGID_CONNECT)
//
  PDPL_Message_Connect = ^TDPL_Message_Connect;
  TDPL_Message_Connect = packed record
    dwSize                 : DWORD;                         // Size of this structure
    hConnectId             : TDPNHandle;                    // Handle of new connection
    pdplConnectionSettings : PDPL_Connection_Settings;	    // Connection settings for this connection
    pvLobbyConnectData     : Pointer;                       // User defined lobby data block
    dwLobbyConnectDataSize : DWORD;                         // Size of user defined lobby data block
    pvConnectionContext    : Pointer;                       // Context value for this connection (user set)
  end;

// 
// Connection settings have been updated
// (DPL_MSGID_CONNECTION_SETTINGS)
//
  PDPL_Message_Connection_Settings = ^TDPL_Message_Connection_Settings;
  TDPL_Message_Connection_Settings = packed record
    dwSize                 : DWORD;                        // Size of this structure
    hSender                : TDPNHandle;                   // Handle of the connection for these settings
    pdplConnectionSettings : PDPL_Connection_Settings;     // Connection settings
    pvConnectionContext    : Pointer;                      // Context value for this connection
  end;

//
// A connection has been disconnected
// (DPL_MSGID_DISCONNECT)
//
  PDPL_Message_Disconnect = ^TDPL_Message_Disconnect;
  TDPL_Message_Disconnect = packed record
    dwSize              : DWORD;                        // Size of this structure
    hDisconnectId       : TDPNHandle;                   // Handle of the connection that was terminated
    hrReason            : HResult;                      // Reason the connection was broken
    pvConnectionContext : Pointer;                      // Context value for this connection
  end;

//
// Data was received through a connection
// (DPL_MSGID_RECEIVE)
//
  PDPL_Message_Receive = ^TDPL_Message_Receive;
  TDPL_Message_Receive = packed record
    dwSize              : DWORD;                        // Size of this structure
    hSender             : TDPNHandle;                   // Handle of the connection that is from
    pBuffer             : PByte;                        // Contents of the message
    dwBufferSize        : DWORD;                        // Size of the message context
    pvConnectionContext : Pointer;                      // Context value for this connection
  end;

//
// Current status of the associated connection
// (DPL_MSGID_SESSION_STATUS)
//
  PDPL_Message_Session_Status = ^TDPL_Message_Session_Status;
  TDPL_Message_Session_Status = packed record
    dwSize              : DWORD;                        // Size of this structure
    hSender             : TDPNHandle;                   // Handle of the connection that this is from
    dwStatus            : DWORD;                        // Status (DPLSESSION_...)
    pvConnectionContext : Pointer;                      // Context value for this connection
  end;

(****************************************************************************
 *
 * DirectPlay8 Functions
 *
 ****************************************************************************)

type
//
// COM definition for DirectPlayLobbyClient
//                                                      
  IDirectPlay8LobbyClient = interface (IUnknown)
    ['{819074A2-016C-11d3-AE14-006097B01411}']
    function Initialize (pvUserContext: Pointer; pfn: TDPNMessageHandler; dwFlags: DWORD): HResult; stdcall;
    function EnumLocalPrograms (pGuidApplication: PGUID; pEnumData: PBYTE;
        var pdwEnumData: DWORD; var pdwItems: DWORD; dwFlags: DWORD): HResult; stdcall;
    function ConnectApplication (const pdplConnectionInfo: TDPL_Connect_Info;
        pvUserApplicationContext: Pointer; phApplication: PDPNHandle;
        dwTimeOut: DWORD; dwFlags: DWORD): HResult; stdcall;
    function Send (hConnection: TDPNHandle; pBuffer: PBYTE; pBufferSize, dwFlags: DWORD): HResult; stdcall;
    function ReleaseApplication (hApplication: TDPNHandle; dwFlags: DWORD): HResult; stdcall;
    function Close (dwFlags: DWORD): HResult; stdcall;
    function GetConnectionSettings (hConnection: TDPNHandle; pdplConnectSettings: PDPL_Connection_Settings;
        var pdwInfoSize: DWORD; dwFlags: DWORD): HResult; stdcall;
    function SetConnectionSettings (hConnection: TDPNHandle;
        const pdplConnectSettings: TDPL_Connection_Settings; dwFlags: DWORD): HResult; stdcall;
  end;

//
// COM definition for DirectPlayLobbiedApplication
//
  IDirectPlay8LobbiedApplication = interface (IUnknown)
    ['{819074A3-016C-11d3-AE14-006097B01411}']
    function Initialize (pvUserContext: Pointer; pfn: TDPNMessageHandler;
        pdpnhConnection: PDPNHandle; dwFlags: DWORD): HResult; stdcall;
    function RegisterProgram (const pdplProgramDesc: TDPL_Program_Desc; dwFlags: DWORD): HResult; stdcall;
    function UnRegisterProgram (const pguidApplication: TGUID; dwFlags: DWORD): HResult; stdcall;
    function Send (hConnection: TDPNHandle; pBuffer: PBYTE; pBufferSize, dwFlags: DWORD): HResult; stdcall;
    function SetAppAvailable (fAvailable: BOOL; dwFlags: DWORD): HResult; stdcall;
    function UpdateStatus (hConnection: TDPNHandle; dwStatus, dwFlags: DWORD): HResult; stdcall;
    function Close (dwFlags: DWORD): HResult; stdcall;
    function GetConnectionSettings (hLobbyClient: TDPNHandle; pdplSessionInfo: PDPL_Connection_Settings;
        var pdwInfoSize: DWORD; dwFlags: DWORD): HResult; stdcall;
    function SetConnectionSettings (hConnection: TDPNHandle;
        const pdplConnectSettings: TDPL_Connection_Settings; dwFlags: DWORD): HResult; stdcall;
  end;

(****************************************************************************
 *
 * DirectPlay8Lobby Interface IIDs
 *
 ****************************************************************************)

 IID_IDirectPlay8LobbyClient        = IDirectPlay8LobbyClient;
 IID_IDirectPlay8LobbiedApplication = IDirectPlay8LobbiedApplication;

(****************************************************************************
 *
 * DirectPlay8Lobby CLSIDs
 *
 ****************************************************************************)
const

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -