// Network.cpp : implementation file
//

#include "stdafx.h"
#include "tcpclient.h"
#include "Network.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CNetwork dialog


CNetwork::CNetwork(CWnd* pParent /*=NULL*/)
	: CDialog(CNetwork::IDD, pParent)
{
	//{{AFX_DATA_INIT(CNetwork)
		// NOTE: the ClassWizard will add member initialization here
	//}}AFX_DATA_INIT
}


void CNetwork::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CNetwork)
		// NOTE: the ClassWizard will add DDX and DDV calls here
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CNetwork, CDialog)
	//{{AFX_MSG_MAP(CNetwork)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CNetwork message handlers

void CNetwork::OnOK() 
{
	// TODO: Add extra validation here

	BYTE f1,f2,f3,f4;
	CIPAddressCtrl *IPAdr = (CIPAddressCtrl*)GetDlgItem(IDC_IPADDRESS);
	IPAdr->GetAddress(f1,f2,f3,f4);
	m_IPAddress.Format("%d.%d.%d.%d",f1,f2,f3,f4);
	
	CEdit *pedit = (CEdit *)GetDlgItem(IDC_PORT);
	CString port;
	pedit->GetWindowText(port);
	m_Port = atoi(port);
	
	CDialog::OnOK();
}
