// SelectCardDlg.cpp : 实现文件
//

#include "stdafx.h"
#include "By5000Asiplay Demo.h"
#include "SelectCardDlg.h"
#include ".\selectcarddlg.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#endif
// CSelectCardDlg 对话框

IMPLEMENT_DYNAMIC(CSelectCardDlg, CDialog)
CSelectCardDlg::CSelectCardDlg(UINT uiCardTotalNumber /*= 1*/,CWnd* pParent /*=NULL*/)
	: CDialog(CSelectCardDlg::IDD, pParent)
	, m_uiCardNumber(0),m_uiCardTotalNumber(uiCardTotalNumber)
{

}

CSelectCardDlg::~CSelectCardDlg()
{
}

void CSelectCardDlg::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
}


BEGIN_MESSAGE_MAP(CSelectCardDlg, CDialog)
	ON_CBN_SELCHANGE(IDC_COMBO_CARD, OnCbnSelchangeComboCard)
	ON_BN_CLICKED(IDOK, OnBnClickedOk)
END_MESSAGE_MAP()


// CSelectCardDlg 消息处理程序

void CSelectCardDlg::OnCbnSelchangeComboCard()
{
	// TODO: 在此添加控件通知处理程序代码
	CComboBox * pBox;

	pBox = (CComboBox *)GetDlgItem(IDC_COMBO_CARD);
	m_uiCardNumber = pBox->GetCurSel();

}

BOOL CSelectCardDlg::OnInitDialog()
{
	CDialog::OnInitDialog();

	// TODO:  在此添加额外的初始化
	UINT i;
	CString strItem;
	CComboBox * pBox;

	pBox = (CComboBox *)GetDlgItem(IDC_COMBO_CARD);
	for(i=0; i<m_uiCardTotalNumber; i++)
	{	
		strItem.Format(_T("%d"), i);
		pBox->AddString(strItem);
	}
	pBox->SetCurSel(0);
	m_uiCardNumber = 0;
	UpdateData();

	return TRUE;  // return TRUE unless you set the focus to a control
	// 异常: OCX 属性页应返回 FALSE
}


void CSelectCardDlg::OnBnClickedOk()
{
	// TODO: 在此添加控件通知处理程序代码
	CComboBox * pBox;

	pBox = (CComboBox *)GetDlgItem(IDC_COMBO_CARD);
	m_uiCardNumber = pBox->GetCurSel();
	OnOK();
}


