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

📄 xsockserverctl.h

📁 基于组态开发的VC源码
💻 H
字号:
#if !defined(AFX_XSOCKSERVERCTL_H__F8505404_DD8F_11D3_B4AF_00C04F2B300E__INCLUDED_)
#define AFX_XSOCKSERVERCTL_H__F8505404_DD8F_11D3_B4AF_00C04F2B300E__INCLUDED_

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

#include "ListenS.h"


typedef CList<CConnectS*, CConnectS*> ConnectEntryList;


// XSockServerCtl.h : Declaration of the CXSockServerCtrl ActiveX Control class.

/////////////////////////////////////////////////////////////////////////////
// CXSockServerCtrl : See XSockServerCtl.cpp for implementation.

class CXSockServerCtrl : public COleControl
{
	DECLARE_DYNCREATE(CXSockServerCtrl)

	friend class CListenS;
	friend class CConnectS;

// Constructor
public:
	CXSockServerCtrl();

// Overrides
	// ClassWizard generated virtual function overrides
	//{{AFX_VIRTUAL(CXSockServerCtrl)
	public:
	virtual void OnDraw(CDC* pdc, const CRect& rcBounds, const CRect& rcInvalid);
	virtual void DoPropExchange(CPropExchange* pPX);
	virtual void OnResetState();
	//}}AFX_VIRTUAL

// Implementation
protected:
	~CXSockServerCtrl();

	DECLARE_OLECREATE_EX(CXSockServerCtrl)    // Class factory and guid
	DECLARE_OLETYPELIB(CXSockServerCtrl)      // GetTypeInfo
	DECLARE_PROPPAGEIDS(CXSockServerCtrl)     // Property page IDs
	DECLARE_OLECTLTYPE(CXSockServerCtrl)		// Type name and misc status

// Message maps
	//{{AFX_MSG(CXSockServerCtrl)
	//}}AFX_MSG
	DECLARE_MESSAGE_MAP()

// Dispatch maps
	//{{AFX_DISPATCH(CXSockServerCtrl)
	afx_msg BSTR GetLocalAddress();
	afx_msg void SetLocalAddress(LPCTSTR lpszNewValue);
	afx_msg long GetLocalPort();
	afx_msg void SetLocalPort(long nNewValue);
	afx_msg BOOL GetNullTerminate();
	afx_msg void SetNullTerminate(BOOL bNewValue);
	afx_msg long GetReceiveBufferCount();
	afx_msg void SetReceiveBufferCount(long nNewValue);
	afx_msg BOOL Listen();
	afx_msg BOOL Send(long lChildId, LPCTSTR lpData, long nDataLen);
	afx_msg void Close();
	//}}AFX_DISPATCH
	DECLARE_DISPATCH_MAP()

	afx_msg void AboutBox();

// Event maps
	//{{AFX_EVENT(CXSockServerCtrl)
	void FireOnError(LPCTSTR lpErrorDescription)
		{FireEvent(eventidOnError,EVENT_PARAM(VTS_BSTR), lpErrorDescription);}
	void FireOnClose(long lChildId)
		{FireEvent(eventidOnClose,EVENT_PARAM(VTS_I4), lChildId);}
	void FireOnReceive(long lChildId, LPCTSTR lpData, long nDataLen)
		{FireEvent(eventidOnReceive,EVENT_PARAM(VTS_I4  VTS_BSTR  VTS_I4), lChildId, lpData, nDataLen);}
	void FireOnAccept(long lChildId)
		{FireEvent(eventidOnAccept,EVENT_PARAM(VTS_I4), lChildId);}
	//}}AFX_EVENT
	DECLARE_EVENT_MAP()

// Dispatch and event IDs
public:
	enum {
	//{{AFX_DISP_ID(CXSockServerCtrl)
	dispidLocalAddress = 1L,
	dispidLocalPort = 2L,
	dispidNullTerminate = 3L,
	dispidReceiveBufferCount = 4L,
	dispidListen = 5L,
	dispidSend = 6L,
	dispidClose = 7L,
	eventidOnError = 1L,
	eventidOnClose = 2L,
	eventidOnReceive = 3L,
	eventidOnAccept = 4L,
	//}}AFX_DISP_ID
	};

	CConnectS* GetConnectSObject(long lChildId);
	void DeleteList();
	
	CListenS m_ListenS;
	BOOL m_bNullTerminate;
	BOOL SocketError();
	void SocketError(int nErrorCode);
	BOOL m_bListen;

	CString m_LocalAddress;
	long m_LocalPort;
	CBitmap m_bitmap;
	char* m_lpBuff;
	long m_nBuffLen;


	ConnectEntryList m_list;
};


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

#endif // !defined(AFX_XSOCKSERVERCTL_H__F8505404_DD8F_11D3_B4AF_00C04F2B300E__INCLUDED)

⌨️ 快捷键说明

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