Click here to Skip to main content
Click here to Skip to main content
Add your own
alternative version

Network Development Kit 2.0

, 29 Dec 2006 CPOL
Network Development Kit is a set of simple classes for a client-server architecture.
ndk_demo.zip
NDK_demo
ChatClient
res
ChatClient.ico
NDK
ChatServer
res
ChatServer.ico
NDK
ChatClient.exe
ChatServer.exe
ndk_dll_demo.zip
NDK_dll_demo
ChatClient.exe
ChatServer.exe
NDK.dll
ChatClient
res
ChatClient.ico
ChatServer
res
ChatServer.ico
NDK
NDK.def
res
ndk_dll_src.zip
NDK_dll_src
res
NDK.def
mssccprj.scc
vssver.scc
ndk_src.zip
NDK_src
// ChatClientDlg.h : header file
//

#if !defined(AFX_CHATCLIENTDLG_H__2BEFF042_8F5F_41E9_B02A_06FE15E3BF09__INCLUDED_)
#define AFX_CHATCLIENTDLG_H__2BEFF042_8F5F_41E9_B02A_06FE15E3BF09__INCLUDED_

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

#include "NDKClient.h"

/////////////////////////////////////////////////////////////////////////////
// CChatClientDlg dialog

// NDK: public CNDKClient added
class CChatClientDlg : public CDialog, public CNDKClient
{
// Construction
public:
	CChatClientDlg(CWnd* pParent = NULL);	// standard constructor
	
// Dialog Data
	//{{AFX_DATA(CChatClientDlg)
	enum { IDD = IDD_CHATCLIENT_DIALOG };
	CEdit	m_editChatOutput;
	CEdit	m_editChatInput;
	CButton	m_buttonSendBigMessage;
	CButton	m_buttonSend;
	CButton	m_buttonPingServer;
	CButton	m_buttonConnect;
	CString	m_strIp;
	long	m_lPort;
	CString	m_strChatInput;
	CString	m_strNickname;
	//}}AFX_DATA

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

// Implementation
protected:
	HICON m_hIcon;

// NDK: overrides OnMessage, OnDisconnect and OnPing

	// Called when a message is received. The derived class must override this
	// method.
	virtual void OnMessage(CNDKMessage& message);

	// Called whenever an unexpected disconnection occurs. The only case when
	// this method isn't call is when CloseConnection is used. CloseConnection
	// don't need to be called when when OnDisconnect is called. The derived 
	// class must override this method.
	virtual void OnDisconnect(NDKClientDisconnection disconnectionType);

	// Called when the ping from the server is received. The number of
	// milliseconds is returned since PingServer was called.
	virtual void OnPing(long lNbMilliseconds);

	// Generated message map functions
	//{{AFX_MSG(CChatClientDlg)
	virtual BOOL OnInitDialog();
	afx_msg void OnSysCommand(UINT nID, LPARAM lParam);
	afx_msg void OnPaint();
	afx_msg HCURSOR OnQueryDragIcon();
	afx_msg void OnButtonConnect();
	afx_msg void OnButtonPingServer();
	afx_msg void OnButtonSend();
	afx_msg void OnButtonSendBigMessage();
	//}}AFX_MSG
	DECLARE_MESSAGE_MAP()

private:
	void UpdateUI();
	void AddText(const CString& strText);
	void AddSystemText(const CString& strText);
};

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

#endif // !defined(AFX_CHATCLIENTDLG_H__2BEFF042_8F5F_41E9_B02A_06FE15E3BF09__INCLUDED_)

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

ArchieCoder
Software Developer (Senior) Mirego
Canada Canada
My name is Sébastien Lachance.
 
I love C# developing Windows Phone and Windows 8 applications.
 
When I’m not in front of a computer, my hobbies include playing bridge, poker and other card games, biking, reading technology news.
Follow on   Twitter

| Advertise | Privacy | Terms of Use | Mobile
Web02 | 2.8.141220.1 | Last Updated 29 Dec 2006
Article Copyright 2000 by ArchieCoder
Everything else Copyright © CodeProject, 1999-2014
Layout: fixed | fluid