// IADDgSN.cpp : implementation file
/////////////////////////////////////////////////////////////////////////////
#include "StdAfx.h"

#include "IADDgSN.hpp"
#include "_IADItrf.hpp"

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

/////////////////////////////////////////////////////////////////////////////
// IAD_Dialog_SetNumber dialog

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


//***************************************************************************
IAD_Dialog_SetNumber::IAD_Dialog_SetNumber(CPoint _cpTopLeft,
																					 long _lOldValue,
																					 CWnd* pParent /*=NULL*/)
										: CDialog(IAD_Dialog_SetNumber::IDD, pParent)
{
	m_hOldInstance = AfxGetResourceHandle();
	AfxSetResourceHandle(g_stIADDLLIdentity.hModule);

	//{{AFX_DATA_INIT(IAD_Dialog_SetNumber)
	//}}AFX_DATA_INIT
	
	m_lNewValue = _lOldValue;
	m_pri_cpTopLeft = _cpTopLeft;
}

//**************************************************************************
IAD_Dialog_SetNumber::~IAD_Dialog_SetNumber()
{
	AfxSetResourceHandle(m_hOldInstance);
}

//***************************************************************************
void IAD_Dialog_SetNumber::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);

	//{{AFX_DATA_MAP(IAD_Dialog_SetNumber)
	DDX_Text(pDX, IDC_EDIT_NUMBER, m_lNewValue);
	//}}AFX_DATA_MAP
}

/////////////////////////////////////////////////////////////////////////////
// IAD_Dialog_SetNumber message handlers

//***************************************************************************
BOOL IAD_Dialog_SetNumber::OnInitDialog() 
{
	CDialog::OnInitDialog();
	
	//Moves window
	CRect crWindowRect;
	GetWindowRect(crWindowRect);
	CRect crWindowDestRect;
	crWindowDestRect.top = m_pri_cpTopLeft.y;
	crWindowDestRect.bottom = crWindowDestRect.top + crWindowRect.Height();
	crWindowDestRect.left = m_pri_cpTopLeft.x;
	crWindowDestRect.right = crWindowDestRect.left + crWindowRect.Width();

	MoveWindow(crWindowDestRect);
	
	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}

//***************************************************************************
long IAD_Dialog_SetNumber::m_pub_fn_lGetNumber()
{
	return m_lNewValue;
}
