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

📄 clientprogramdlg.h

📁 Client 和Server 配套的网络连接程序。
💻 H
字号:
// ClientProgramDlg.h : header file
// Copyright (c) 2002
// 
// Written by: Jeff Miles
// Email: jeffmiles99@hotmail.com
//
// Thank you to both Adam Clauss for his IniFile class, and
// Chris Maunder and Warren Young for their System Tray work.
//
// This program is the Client portion to a complete
// Client/Server framework.  Feel free to use this framework
// as the basis for your network application. If you do use
// this framework, please let me know via e-mail.
//
// Since this program has not been extensively tested, expect bugs.
// Please e-mail me any suggestions or bugs that you find, or better
// yet, any modifications that you have made that adds to this programs
// functionality or efficiency.
//
// ***THIS VERSION FIXED THE FOLLOWING TWO BUGS IN VERSION 1.0***
// Known Bug: The Server Program does not compile in Debug mode.
//            Use Release mode instead.
//
// Known Bug: The Server Program's Exit button does not function correctly.
//            Use the "Shut Down Server" button instead.
//


#if !defined(AFX_CLIENTPROGRAMDLG_H__F86F5F7A_55E6_41AA_9A38_81F43FBC4789__INCLUDED_)
#define AFX_CLIENTPROGRAMDLG_H__F86F5F7A_55E6_41AA_9A38_81F43FBC4789__INCLUDED_

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

#include "Socket.h"

#define WM_RECEIVE_MESSAGE (WM_USER +1)
#define WM_DISCONNECT (WM_USER +2)

/////////////////////////////////////////////////////////////////////////////
// CClientProgramDlg dialog

class CClientProgramDlg : public CDialog
{
// Construction
public:
	//Variables
	CListCtrl userList;
	CFile destFile;
	CString destFileMem;
	CString version;
	CString name;
	CString password;
	CString IP;
	bool endServer;
	int nextSocketAvail;
	Socket Sock;
	int nPort;

	//Functions
	void GiveMessage(CString message);
	void SendUserMessage(CString message, int nSock);
	void SendAllUsersMessage(CString message);
	void SendAllUsersMessageExceptForOne(CString message, int nSock);
	void SendServerMessage(CString message);
	LRESULT OnReceiveMessage(WPARAM receiveMessage,LPARAM);
	LRESULT OnDisconnect(WPARAM,LPARAM);
	void MessageReceive(CString newMessage);
	CString ParseMessage(CString message, int nSlot);
	CClientProgramDlg(CWnd* pParent = NULL);	// standard constructor

// Dialog Data
	//{{AFX_DATA(CClientProgramDlg)
	enum { IDD = IDD_CLIENTPROGRAM_DIALOG };
	CString	m_Name;
	CString	m_IP;
	CString	m_Port;
	CString	m_Password;
	//}}AFX_DATA

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

// Implementation
protected:
	HICON m_hIcon;

	// Generated message map functions
	//{{AFX_MSG(CClientProgramDlg)
	virtual BOOL OnInitDialog();
	afx_msg void OnSysCommand(UINT nID, LPARAM lParam);
	afx_msg void OnPaint();
	afx_msg void ConnectToServer();
	afx_msg HCURSOR OnQueryDragIcon();
	//}}AFX_MSG
	DECLARE_MESSAGE_MAP()
};

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

#endif // !defined(AFX_CLIENTPROGRAMDLG_H__F86F5F7A_55E6_41AA_9A38_81F43FBC4789__INCLUDED_)

⌨️ 快捷键说明

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