⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 dlgseriessteup.cpp

📁 EMBEDDED VC++4.0 对WINDOWS CE下的串口通信进行实验.将常用的串口功能封装为一个类,以回调方式读取串口数据,在S3C2410 ARM上通过
💻 CPP
字号:
// DlgSeriesSteup.cpp : implementation file
//

#include "stdafx.h"
#include "SeriesSample.h"
#include "DlgSeriesSteup.h"

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

/////////////////////////////////////////////////////////////////////////////
// DlgSeriesSteup dialog


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


void DlgSeriesSteup::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(DlgSeriesSteup)
		// NOTE: the ClassWizard will add DDX and DDV calls here
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(DlgSeriesSteup, CDialog)
	//{{AFX_MSG_MAP(DlgSeriesSteup)
	ON_BN_CLICKED(IDC_BTNOPEN, OnBtnopen)
	ON_BN_CLICKED(IDC_BTNCLOSE, OnBtnclose)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// DlgSeriesSteup message handlers

void DlgSeriesSteup::OnBtnopen() 
{
	// TODO: Add your control notification handler code here
	CComboBox *pCmbName = NULL;
	CComboBox *pCmbBaud = NULL;
	CComboBox *pCmbParity = NULL;
	CComboBox *pCmbDataBits = NULL;
	CComboBox *pCmbStopBits = NULL;
	
	pCmbName = (CComboBox*)GetDlgItem(IDC_CMBNAME);
	pCmbBaud = (CComboBox*)GetDlgItem(IDC_CMBBAUD);
	pCmbParity = (CComboBox*)GetDlgItem(IDC_CMBPARITY);
	pCmbDataBits = (CComboBox*)GetDlgItem(IDC_CMBDATABITS);
	pCmbStopBits = (CComboBox*)GetDlgItem(IDC_CMBSTOPBITS);
	ASSERT(pCmbName != NULL);
	ASSERT(pCmbBaud != NULL);
	ASSERT(pCmbParity != NULL);
	ASSERT(pCmbDataBits != NULL);
	ASSERT(pCmbStopBits != NULL);
	//得到串口编号
	CString tmpCommName;
	pCmbName->GetWindowText(tmpCommName);
	m_portNo = _wtoi(tmpCommName);
	//得到波特率
	CString tmpBaud;
	pCmbBaud->GetWindowText(tmpBaud);
	m_baud = _wtoi(tmpBaud);
	//得到奇偶校验
	m_parity = pCmbParity->GetCurSel();
	//得到数据位
	CString tmpDataBits;
	pCmbDataBits->GetWindowText(tmpDataBits);
	m_databits = _wtoi(tmpDataBits);
	//得到停止位
	m_stopbits = pCmbStopBits->GetCurSel();
	
    OnOK();	
}

void DlgSeriesSteup::OnBtnclose() 
{
	// TODO: Add your control notification handler code here
	OnClose();	
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -