serverdlg.h

来自「简单的聊天程序」· C头文件 代码 · 共 78 行

H
78
字号
// serverDlg.h : header file
//

#if !defined(AFX_SERVERDLG_H__817BE51A_7C29_47CB_B561_769304929E47__INCLUDED_)
#define AFX_SERVERDLG_H__817BE51A_7C29_47CB_B561_769304929E47__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

/////////////////////////////////////////////////////////////////////////////
// CServerDlg dialog
#include "MySocket.h"

const int WINSOCK_VERSION = 0x0101;		// Required Winsock version 1.1
const int DEFAULT_PROTOCOL  = 0;			// No protocol specified, use default

const int WM_CLIENT_ACCEPT = WM_USER+101;
const int WM_CLIENT_CLOSE = WM_USER+102;
const int WM_CLIENT_READ = WM_USER+103;
const int WM_CLIENT_MESSAGE=WM_USER+105;

class CServerDlg : public CDialog
{
// Construction
public:
	BOOL SendMessageToClient(CMySocket*pMySocket);
	void AddMessageToMessageBar(CString strMessage);
	int Startserver();
	CServerDlg(CWnd* pParent = NULL);	// standard constructor

// Dialog Data
	//{{AFX_DATA(CServerDlg)
	enum { IDD = IDD_SERVER_DIALOG };
	CEdit	m_send_message;
	CEdit	m_message;
	UINT	m_port;
	//}}AFX_DATA

	// ClassWizard generated virtual function overrides
	//{{AFX_VIRTUAL(CServerDlg)
	protected:
	virtual void DoDataExchange(CDataExchange* pDX);	// DDX/DDV support
	//}}AFX_VIRTUAL

// Implementation
protected:
	HICON m_hIcon;

	// Generated message map functions
	//{{AFX_MSG(CServerDlg)
	virtual BOOL OnInitDialog();
	afx_msg void OnSysCommand(UINT nID, LPARAM lParam);
	afx_msg void OnPaint();
	afx_msg HCURSOR OnQueryDragIcon();
	afx_msg void OnStartServerButton();
	afx_msg void OnDestroy();
	afx_msg void OnSendButton();
	//}}AFX_MSG
	afx_msg LRESULT OnClientAccept(WPARAM wParam,LPARAM lParam);
	afx_msg LRESULT OnClientMessage(WPARAM wParam,LPARAM lParam);
	afx_msg LRESULT OnClientRead(WPARAM wParam,LPARAM lParam);
	afx_msg LRESULT OnClientClose(WPARAM wParam,LPARAM lParam);
	DECLARE_MESSAGE_MAP()
private:
	BOOL		m_serverON;
	SOCKET		m_serverSocket;
	SOCKADDR_IN	m_serverAddress;
	CTypedPtrList<CObList,CMySocket*>m_socket_list;
private:
	CMySocket* GetCurMessageSocket(SOCKET socket);
};

//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.

#endif // !defined(AFX_SERVERDLG_H__817BE51A_7C29_47CB_B561_769304929E47__INCLUDED_)

⌨️ 快捷键说明

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