/***************************************************************************
**
**    $Header:   D:/EPSLDV1/SRC/LOG/EMUMON.CPP   1.7   20 Jun 1996 09:26:58   ZJRD  $
**
**    $Log:   D:/EPSLDV1/SRC/LOG/EMUMON.CPP  $
** 
**    Rev 1.7   20 Jun 1996 09:26:58   ZJRD
** EasyPack/SLD Version 1.20a
** 
**    Rev 1.5   10 Jun 1996 10:21:36   ZJRD
** EasyPack/SLD Version 1.20
** 
**    Rev 1.3   29 May 1996 09:31:54   ZJRD
** No change.
** 
**    Rev 1.2   16 May 1996 09:03:06   ZJRD
** No change.
** 
**    Rev 1.1   10 May 1996 09:14:38   ZJRD
** No change.
** 
**    Rev 1.0   02 May 1996 10:29:28   ZJRD
** Initial revision.
** 
****************************************************************************/


// emumon.cpp : implementation file
//

#include "stdafx.h"
#include "resource.h"

#include "emumon.h" 
// For address server
//
#include "address.h"
#include "addrapi.h"

#ifdef _DEBUG
#undef THIS_FILE
static char BASED_CODE THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CGoMonitorDlg dialog


CGoMonitorDlg::CGoMonitorDlg(CWnd* pParent /*=NULL*/)
	: CDialog(CGoMonitorDlg::IDD, pParent)
{
	//{{AFX_DATA_INIT(CGoMonitorDlg)
	m_strCount = "";
	//}}AFX_DATA_INIT
}


void CGoMonitorDlg::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CGoMonitorDlg)
	DDX_Text(pDX, IDC_EDIT_MONITORCOUNT, m_strCount);
	//}}AFX_DATA_MAP
}

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


/////////////////////////////////////////////////////////////////////////////
// CGoMonitorDlg message handlers

BOOL CGoMonitorDlg::OnInitDialog() 
{
	CDialog::OnInitDialog();
	
	// TODO: Add extra initialization here

	CenterWindow();
	m_strCount = "";	
	m_nCount = 1;
	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}

void CGoMonitorDlg::OnOK() 
{
	// TODO: Add extra validation here
	ADDRESS count;
	ADDR_RETCODE retCode;
	UpdateData(TRUE);
	retCode = AdrTextToAddr(m_strCount, count, 0);	// For count
	if (ADR_OK == retCode && SPACE_UNDEFINE == count.adrSpace &&
	    count.adrAddress >0 && count.adrAddress <= 255) {
		// count.adrSpace = SPACE_UNDEFINE;
		// count.adrAddress = (DWORD);\
		
		m_nCount = (int) count.adrAddress;
		
	} else {
		AfxMessageBox("Invalid input!");
		return;
  }
	
	CDialog::OnOK();
}
