📄 main.h
字号:
//-----------------------------------------------------------------------------
// Name: Sockets_TurnGame
//
// Description: Example code showing how to implement
// simple turn-based gameplay over TCP/IP
//
// File Function: Header file (main.h)
//
// Code:
// Copyright (c) 2003 LostLogic Corporation. All rights reserved.
//
// Libraries Required:
// ws2_32.lib
// winmm.lib
//
// Local Files Required:
// main.h
// main.cpp
//
//-----------------------------------------------------------------------------
// Standard Includes
#include <iostream.h>
#include <winsock.h>
#include <stdio.h>
// Window control IDs
#define IDC_hEB_InputField 40000
#define IDC_hBU_Connect 40001
#define IDC_hLB_Output 40002
#define IDC_hEB_InputServerIP 40003
#define IDC_hEB_InputServerPort 40004
#define IDC_hST_TextServerIP 40006
#define IDC_hST_TextServerPort 40007
#define IDC_hBU_Host 40009
#define IDC_hBU_TurnDone 40010
// Window control handles
HWND hEB_InputField = NULL;
HWND hEB_InputServerIP = NULL;
HWND hEB_InputServerPort = NULL;
HWND hBU_Connect = NULL;
HWND hLB_Output = NULL;
HWND hST_TextServerIP = NULL;
HWND hST_TextServerPort = NULL;
HWND hBU_Host = NULL;
HWND hBU_TurnDone = NULL;
// Window program information
LPCTSTR lpszApplicationName = "Sockets_TurnGame";
LPCTSTR lpszTitle = "Sockets_TurnGame";
HWND g_hWnd;
HINSTANCE g_hInst;
// Socket vars
SOCKET g_skListenSocket;
SOCKET g_skClientSocket;
bool g_bIsServer = 0;
bool g_bMyTurn = 0;
bool g_bConnected = 0;
// Socket functions
void vHost();
void vInitializeSockets( void );
void vShutdownSockets( void );
void vConnect( void );
void vSendTurnMessage( void );
void vReceiveTurnMessage( void );
void vTurnDone( void );
// Windows functions
LRESULT CALLBACK fnMessageProcessor (HWND, UINT, WPARAM, LPARAM);
void vCreateWindowControls( HWND hWnd );
void vShowText( char *szText );
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -