chatserverdoc.h

来自「基于winsock的聊天程序」· C头文件 代码 · 共 83 行

H
83
字号
// ChatServerDoc.h : interface of the CChatServerDoc class
//
/////////////////////////////////////////////////////////////////////////////

#if !defined(AFX_CHATSERVERDOC_H__A6F9898D_86F6_4B82_ADC5_B908990C11F5__INCLUDED_)
#define AFX_CHATSERVERDOC_H__A6F9898D_86F6_4B82_ADC5_B908990C11F5__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#include "listenSocket.h"
#include "ClientSocket.h"
#include <afxtempl.h>
class CMsg;

class CChatServerDoc : public CRichEditDoc
{
protected: // create from serialization only
	CChatServerDoc();
	DECLARE_DYNCREATE(CChatServerDoc)

// Attributes
public:

	CListeningSocket* m_pSocket;
	CTypedPtrList<CPtrList, CMsg*> m_lsMsg;
	LONG m_lCount;

	CPtrList m_connectionList;
// Operations
public:

	void OnUpdateMessages();
	void OnUpdateConnections();
	void UpdateList(CClientSocket* pSocket);
	void Clean();
	void UpdateClients();
	void ProcessPendingAccept();
	void ProcessPendingRead(CClientSocket* pSocket);
	CMsg* AssembleMsg(CClientSocket* pSocket);
	CMsg* ReadMsg(CClientSocket* pSocket);
	void SendMsg(CClientSocket* pSocket, CMsg* pMsg);
	void CloseSocket(CClientSocket* pSocket);
	void DeleteSocket();
	void Message(LPCTSTR lpszMessage,COLORREF clr);
	//void Message1(LPCTSTR lpszMessage);
	void talk(int type2, CString from1, CString to1, CString str1,COLORREF clr);
// Overrides
	// ClassWizard generated virtual function overrides
	//{{AFX_VIRTUAL(CChatServerDoc)
	public:
	virtual void DeleteContents();
	virtual BOOL OnNewDocument();
	virtual void Serialize(CArchive& ar);
	//}}AFX_VIRTUAL
	virtual CRichEditCntrItem* CreateClientItem(REOBJECT* preo) const;

// Implementation
public:
	
	virtual ~CChatServerDoc();
#ifdef _DEBUG
	virtual void AssertValid() const;
	virtual void Dump(CDumpContext& dc) const;
#endif

protected:

// Generated message map functions
protected:
	//{{AFX_MSG(CChatServerDoc)
	afx_msg void OnServerBrandcast();
	//}}AFX_MSG
	DECLARE_MESSAGE_MAP()
};

/////////////////////////////////////////////////////////////////////////////

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

#endif // !defined(AFX_CHATSERVERDOC_H__A6F9898D_86F6_4B82_ADC5_B908990C11F5__INCLUDED_)

⌨️ 快捷键说明

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