/***************************************************************************
**
**    $Header:   D:/ECB2S/SRC/LOG/EMUMON.CPP   1.2.1.5   17 Apr 1997 15:48:40   ZJRD  $
**
**    $Log:   D:/ECB2S/SRC/LOG/EMUMON.CPP  $
** 
**    Rev 1.2.1.5   17 Apr 1997 15:48:40   ZJRD
** No change.
** 
**    Rev 1.2.1.4   16 Apr 1997 10:19:58   ZJRD
** No change.
** 
**    Rev 1.2.1.3   10 Apr 1997 15:31:22   ZJRD
** 2.09F
** 
**    Rev 1.2.1.1   03 Apr 1997 15:12:12   ZJRD
** No change.
** 
**    Rev 1.2.1.0   28 Mar 1997 10:17:12   ZJRD
** easy pack sld 2.09d
** 
**    Rev 1.1   19 Mar 1997 11:28:20   ZJRD
** No change.
** 
**    Rev 1.0   12 Mar 1997 14:46:06   ZJRD
** Initial revision.
** 
**    Rev 1.6.1.0.1.2   09 Dec 1996 10:17:00   ZJRD
** EasyPack/SLD Version 2.0P
** 
**    Rev 1.6.1.0.1.0   11 Nov 1996 13:00:16   ZJRD
** EasyPack/SLD Version 2.01
** 
**    Rev 1.6.1.4   09 Sep 1996 13:20:42   ZJRD
** No change.
** 
**    Rev 1.6.1.3   05 Sep 1996 11:32:12   ZJRD
** No change.
** 
**    Rev 1.6.1.2   02 Sep 1996 09:59:16   ZJRD
** No change.
** 
**    Rev 1.6.1.1   28 Aug 1996 15:46:14   ZJRD
** No change.
** 
**    Rev 1.6.1.0   12 Aug 1996 10:51:10   ZJRD
** EasyPack/SLD Version 1.98
** 
**    Rev 1.4   05 Jun 1996 14:53:16   ZJRD
** No change.
** 
**    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 = "1";
	//}}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_nCount = 1;
	
	UpdateData(FALSE);
	
	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();
}
