
/***************************************************************************
**
**    $Header:   D:/PICSLDV/SRC/LOG/EMUMON.CPP   1.14   09 Jan 1997 14:23:20   ZJRD  $
**
**    $Log:   D:/PICSLDV/SRC/LOG/EMUMON.CPP  $
** 
**    Rev 1.14   09 Jan 1997 14:23:20   ZJRD
** No change.
** 
**    Rev 1.13   13 Dec 1996 11:18:24   ZJRD
** No change.
** 
**    Rev 1.12   22 Nov 1996 10:59:22   ZJRD
** No change.
** 
**    Rev 1.11   11 Nov 1996 12:46:40   ZJRD
** No change.
** 
**    Rev 1.10   06 Nov 1996 12:58:36   ZJRD
** No change.
** 
**    Rev 1.9   02 Nov 1996 09:46:38   ZJRD
** No change.
** 
**    Rev 1.8   30 Oct 1996 12:48:54   ZJRD
** No change.
** 
**    Rev 1.7   28 Oct 1996 09:41:48   ZJRD
** No change.
** 
**    Rev 1.6   21 Oct 1996 09:16:08   ZJRD
** PIC/SLD Version 0.91
** 
**    Rev 1.5   09 Oct 1996 13:45:44   ZJRD
** No change.
** 
**    Rev 1.4   23 Sep 1996 10:32:42   ZJRD
** No change.
** 
**    Rev 1.3   06 Sep 1996 13:46:36   ZJRD
** No change.
** 
**    Rev 1.2   02 Sep 1996 11:27:42   ZJRD
** No change.
** 
**    Rev 1.1   15 Aug 1996 10:06:02   ZJRD
** No change.
** 
**    Rev 1.0   13 Aug 1996 09:18:22   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_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();
}
