// TimerDlg.cpp : implementation file
//

#include "stdafx.h"
#include "TimerUser.h"
#include "TimerDlg.h"

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

/////////////////////////////////////////////////////////////////////////////
// CTimerDlg dialog


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


void CTimerDlg::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CTimerDlg)
	DDX_Control(pDX, IDC_TIMERCTRL1, m_Timer);
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CTimerDlg, CDialog)
	//{{AFX_MSG_MAP(CTimerDlg)
	ON_BN_CLICKED(IDC_SETALARM, OnSetalarm)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CTimerDlg message handlers

void CTimerDlg::OnSetalarm() 
{
	UINT DelaySeconds = GetDlgItemInt(IDC_EDIT1) ;
	m_Timer.SetAlarm (DelaySeconds) ;	
}

BEGIN_EVENTSINK_MAP(CTimerDlg, CDialog)
    //{{AFX_EVENTSINK_MAP(CTimerDlg)
	ON_EVENT(CTimerDlg, IDC_TIMERCTRL1, 1 /* AlarmExpired */, OnAlarmExpiredTimerctrl1, VTS_I4)
	//}}AFX_EVENTSINK_MAP
END_EVENTSINK_MAP()

void CTimerDlg::OnAlarmExpiredTimerctrl1(long TicksNow) 
{
	MessageBeep (0) ;
	OnCancel ( ) ;	
}
