BELLHOP.H

/*========================================================================== 
*
* Copyright (C) 1996-1997 Microsoft Corporation. All Rights Reserved.
*
* File: bellhop.h
* Content:Header file for bellhop.cpp
*
***************************************************************************/

#define IDIRECTPLAY2_OR_GREATER
#include <windows.h>
#include <windowsx.h>
#include <dplay.h>
#include <dplobby.h>
#include "CGRpTree.h"

// constants
const DWORD MAXPLAYERS = 10;// max no. players in the session
const DWORD MAXSTRLEN = 200;// max. size of a string

// structure used to store DirectPlay information
typedef struct {
LPDIRECTPLAY3AlpDirectPlay3A;// IDirectPlay3A interface pointer
LPDIRECTPLAYLOBBY2AlpDirectPlayLobby2A;// IDirectPlayLobby2A interface pointer
HANDLEhPlayerEvent;// player event to use
DPIDdpidPlayer;// ID of player created
BOOLbIsHost;// TRUE if we are hosting the session
BOOLbSecureSession;// TRUE if the session is secure.
DWORDdwPlayerFlags;
CGroupTree*lpGroupTree;
intxPaneSplit;
intxHalfSplitWidth;
intySpacing;
intxSpacing;
BOOLbSplitMove;
charszSecureName[256];
charszSecurePassword[256];
charszSecureDomain[256];
} DPLAYINFO, *LPDPLAYINFO;

typedef struct {
HWNDhWnd;
intidCombo;
} ENUMCONNSTRUCT, *LPENUMCONNSTRUCT;

typedef struct {
GUIDguidSP;
BYTEConnection[1];
} CONNECTIONINFO, *LPCONNECTIONINFO;

typedef struct {
GUIDguidInstance;
DWORDdwFlags;
} SESSIONINFO, *LPSESSIONINFO;

typedef struct {
LPDPLAYINFOlpDPInfo;
DPIDdpidRoom;
} LOBBYGROUPCONTEXT, *LPLOBBYGROUPCONTEXT;

typedef struct {
GUIDguidApplication;
CHARszAppName[MAXSTRLEN];
} APPNAMECONTEXT, *LPAPPNAMECONTEXT;

// guid for this application
// {4BF5D540-BDA5-11d0-9C4F-00A0C905425E}
DEFINE_GUID(BELLHOP_GUID,
0x4bf5d540, 0xbda5, 0x11d0, 0x9c, 0x4f, 0x0, 0xa0, 0xc9, 0x5, 0x42, 0x5e);

// prototypes
extern HRESULTCreateDirectPlayInterface(LPDIRECTPLAY3A *lplpDirectPlay3A );
extern HRESULTCreateDirectPlayLobbyInterface(LPDIRECTPLAYLOBBY2A *lplpDirectPlayLobby2A );
extern HRESULTConnectUsingDialog(HINSTANCE hInstance, LPDPLAYINFO lpDPInfo);
extern voidErrorBox(LPSTR lpszErrorStr, HRESULT hr);

// prototypes BELLHOP.CPP
BOOL CALLBACKLobbyWndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
BOOL CALLBACKConnectionSettingsDialogProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam);

HRESULTSetupConnection(HINSTANCE hInstance, LPDPLAYINFO lpDPInfo);
HRESULTShutdownConnection(LPDPLAYINFO lpDPInfo);
DWORD WINAPIReceiveThread(LPVOID lpThreadParameter);
HRESULTReceiveMessage(LPDPLAYINFO lpDPInfo);
voidHandleApplicationMessage(LPDPLAYINFO lpDPInfo, LPDPMSG_GENERIC lpMsg, DWORD dwMsgSize,
DPID idFrom, DPID idTo);
voidHandleSystemMessage(LPDPLAYINFO lpDPInfo, LPDPMSG_GENERIC lpMsg, DWORD dwMsgSize,
DPID idFrom, DPID idTo);
HRESULTGetPlayerName(LPDIRECTPLAY3A lpDirectPlay3A, DPID dpidPlayer,
LPDPNAME *lplpName);
HRESULTGetGroupName(LPDIRECTPLAY3A lpDirectPlay3A, DPID dpidGroup,
LPDPNAME *lplpName);
HRESULTNewChatString(LPDIRECTPLAY3A lpDirectPlay3A, DPID dpidPlayer,
LPSTR lpszMsg, LPSTR *lplpszStr);
HRESULTDoCreateRoom(HWND hWnd, LPDPLAYINFO lpDPInfo);
HRESULTDoDeleteRoom(HWND hWnd, LPDPLAYINFO lpDPInfo);
HRESULTDoCreateTable(HWND hWnd, LPDPLAYINFO lpDPInfo);
HRESULTDoDeleteTable(HWND hWnd, LPDPLAYINFO lpDPInfo);
HRESULTDoDeletePlayerFromGroup(HWND hWnd, LPDPLAYINFO lpDPInfo);
HRESULTDoLaunch(HWND hWnd, LPDPLAYINFO lpDPInfo);
HRESULTDoGroupConnectionSettings(HWND hWnd, LPDPLAYINFO lpDPInfo);
HRESULTInitializeLobby(HWND hWnd, LPDPLAYINFO lpDPInfo);
HRESULTUpdateLobbyDisplay(HWND hWnd, LPDPLAYINFO lpDPInfo);
voidUpdateButtons(HWND hWnd, LPDPLAYINFO lpDPInfo);
HRESULTSendChatMessage(HWND hWnd, LPDPLAYINFO lpDPInfo);

extern voidEnableDlgButton(HWND hWnd, int nIDDlgItem, BOOL bEnable);
voidHandleStartSession(LPDPLCONNECTION lpConn, LPDPLAYINFO lpDPInfo );
BOOL FAR PASCALEnumApp(LPCDPLAPPINFO lpAppInfo, LPVOID lpContext, DWORD dwFlags);
HRESULTGetComboBoxGuid(HWND hWnd, LONG iDialogItem, LPGUID lpguidReturn);
HRESULTGetLocalAppName(LPDIRECTPLAYLOBBY lpIDPL,
LPGUID lpguidApplication, LPSTR lpszAppName);
voidLogString(LPSTR lpszDisplayFormat, LPSTR lpszDataStr);
voidOnSize(HWND hWnd, LPDPLAYINFO lpDPInfo);

// Globals
extern HINSTANCE ghInstance;