BELLHOP.H
上传用户:bangxh
上传日期:2007-01-31
资源大小:42235k
文件大小:4k
源码类别:

Windows编程

开发平台:

Visual C++

  1. /*==========================================================================
  2.  *
  3.  *  Copyright (C) 1996-1997 Microsoft Corporation.  All Rights Reserved.
  4.  *
  5.  *  File:       bellhop.h
  6.  *  Content: Header file for bellhop.cpp
  7.  *
  8.  ***************************************************************************/
  9. #define IDIRECTPLAY2_OR_GREATER
  10. #include <windows.h>
  11. #include <windowsx.h>
  12. #include <dplay.h>
  13. #include <dplobby.h>
  14. #include "CGRpTree.h"
  15. // constants
  16. const DWORD MAXPLAYERS = 10; // max no. players in the session
  17. const DWORD MAXSTRLEN = 200; // max. size of a string
  18. // structure used to store DirectPlay information
  19. typedef struct {
  20. LPDIRECTPLAY3A lpDirectPlay3A; // IDirectPlay3A interface pointer
  21. LPDIRECTPLAYLOBBY2A lpDirectPlayLobby2A; // IDirectPlayLobby2A interface pointer
  22. HANDLE hPlayerEvent; // player event to use
  23. DPID dpidPlayer; // ID of player created
  24. BOOL bIsHost; // TRUE if we are hosting the session
  25. BOOL bSecureSession; // TRUE if the session is secure.
  26. DWORD dwPlayerFlags;
  27. CGroupTree * lpGroupTree;
  28. int xPaneSplit;
  29. int xHalfSplitWidth;
  30. int ySpacing;
  31. int xSpacing;
  32. BOOL bSplitMove;
  33. char szSecureName[256];
  34. char szSecurePassword[256];
  35. char szSecureDomain[256];
  36. } DPLAYINFO, *LPDPLAYINFO;
  37. typedef struct {
  38. HWND hWnd;
  39. int idCombo;
  40. } ENUMCONNSTRUCT, *LPENUMCONNSTRUCT;
  41. typedef struct {
  42. GUID guidSP;
  43. BYTE Connection[1];
  44. } CONNECTIONINFO, *LPCONNECTIONINFO;
  45. typedef struct {
  46. GUID guidInstance;
  47. DWORD dwFlags;
  48. } SESSIONINFO, *LPSESSIONINFO;
  49. typedef struct {
  50. LPDPLAYINFO lpDPInfo;
  51. DPID dpidRoom;
  52. } LOBBYGROUPCONTEXT, *LPLOBBYGROUPCONTEXT;
  53. typedef struct {
  54. GUID guidApplication;
  55. CHAR szAppName[MAXSTRLEN];
  56. } APPNAMECONTEXT, *LPAPPNAMECONTEXT;
  57. // guid for this application
  58. // {4BF5D540-BDA5-11d0-9C4F-00A0C905425E}
  59. DEFINE_GUID(BELLHOP_GUID, 
  60. 0x4bf5d540, 0xbda5, 0x11d0, 0x9c, 0x4f, 0x0, 0xa0, 0xc9, 0x5, 0x42, 0x5e);
  61. // prototypes
  62. extern HRESULT CreateDirectPlayInterface(LPDIRECTPLAY3A *lplpDirectPlay3A );
  63. extern HRESULT CreateDirectPlayLobbyInterface(LPDIRECTPLAYLOBBY2A *lplpDirectPlayLobby2A );
  64. extern HRESULT ConnectUsingDialog(HINSTANCE hInstance, LPDPLAYINFO lpDPInfo);
  65. extern void ErrorBox(LPSTR lpszErrorStr, HRESULT hr);
  66. // prototypes BELLHOP.CPP
  67. BOOL CALLBACK LobbyWndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
  68. BOOL CALLBACK ConnectionSettingsDialogProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
  69. HRESULT SetupConnection(HINSTANCE hInstance, LPDPLAYINFO lpDPInfo);
  70. HRESULT ShutdownConnection(LPDPLAYINFO lpDPInfo);
  71. DWORD WINAPI ReceiveThread(LPVOID lpThreadParameter);
  72. HRESULT ReceiveMessage(LPDPLAYINFO lpDPInfo);
  73. void HandleApplicationMessage(LPDPLAYINFO lpDPInfo, LPDPMSG_GENERIC lpMsg, DWORD dwMsgSize,
  74.  DPID idFrom, DPID idTo);
  75. void HandleSystemMessage(LPDPLAYINFO lpDPInfo, LPDPMSG_GENERIC lpMsg, DWORD dwMsgSize,
  76. DPID idFrom, DPID idTo);
  77. HRESULT GetPlayerName(LPDIRECTPLAY3A lpDirectPlay3A, DPID dpidPlayer,
  78.   LPDPNAME *lplpName);
  79. HRESULT GetGroupName(LPDIRECTPLAY3A lpDirectPlay3A, DPID dpidGroup,
  80.  LPDPNAME *lplpName);
  81. HRESULT NewChatString(LPDIRECTPLAY3A lpDirectPlay3A, DPID dpidPlayer,
  82.   LPSTR lpszMsg, LPSTR *lplpszStr);
  83. HRESULT DoCreateRoom(HWND hWnd, LPDPLAYINFO lpDPInfo);
  84. HRESULT DoDeleteRoom(HWND hWnd, LPDPLAYINFO lpDPInfo);
  85. HRESULT DoCreateTable(HWND hWnd, LPDPLAYINFO lpDPInfo);
  86. HRESULT DoDeleteTable(HWND hWnd, LPDPLAYINFO lpDPInfo);
  87. HRESULT DoDeletePlayerFromGroup(HWND hWnd, LPDPLAYINFO lpDPInfo);
  88. HRESULT DoLaunch(HWND hWnd, LPDPLAYINFO lpDPInfo);
  89. HRESULT DoGroupConnectionSettings(HWND hWnd, LPDPLAYINFO lpDPInfo);
  90. HRESULT InitializeLobby(HWND hWnd, LPDPLAYINFO lpDPInfo);
  91. HRESULT UpdateLobbyDisplay(HWND hWnd, LPDPLAYINFO lpDPInfo);
  92. void UpdateButtons(HWND hWnd, LPDPLAYINFO lpDPInfo);
  93. HRESULT SendChatMessage(HWND hWnd, LPDPLAYINFO lpDPInfo);
  94. extern void EnableDlgButton(HWND hWnd, int nIDDlgItem, BOOL bEnable);
  95. void HandleStartSession(LPDPLCONNECTION lpConn, LPDPLAYINFO lpDPInfo );
  96. BOOL FAR PASCAL EnumApp(LPCDPLAPPINFO lpAppInfo, LPVOID lpContext, DWORD dwFlags);
  97. HRESULT GetComboBoxGuid(HWND hWnd, LONG iDialogItem, LPGUID lpguidReturn);
  98. HRESULT GetLocalAppName(LPDIRECTPLAYLOBBY lpIDPL,
  99. LPGUID lpguidApplication, LPSTR lpszAppName);
  100. void LogString(LPSTR lpszDisplayFormat, LPSTR lpszDataStr);
  101. void OnSize(HWND hWnd, LPDPLAYINFO lpDPInfo);
  102. // Globals
  103. extern HINSTANCE ghInstance;