📄 dlgseriessetup.cpp
字号:
// DlgSeriesSetup.cpp : implementation file
//
#include "stdafx.h"
#include "RS485Comm.h"
#include "DlgSeriesSetup.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CDlgSeriesSetup dialog
CDlgSeriesSetup::CDlgSeriesSetup(CWnd* pParent /*=NULL*/)
: CDialog(CDlgSeriesSetup::IDD, pParent)
{
//{{AFX_DATA_INIT(CDlgSeriesSetup)
// NOTE: the ClassWizard will add member initialization here
//}}AFX_DATA_INIT
m_ComPort=1;
m_Baudrate=115200;
}
void CDlgSeriesSetup::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CDlgSeriesSetup)
DDX_Control(pDX, IDC_CMBBAUD, m_ComboBaudrate);
DDX_Control(pDX, IDC_CMBNAME, m_ComboComPort);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CDlgSeriesSetup, CDialog)
//{{AFX_MSG_MAP(CDlgSeriesSetup)
ON_CBN_SELCHANGE(IDC_CMBNAME, OnSelchangeCmbname)
ON_CBN_SELCHANGE(IDC_CMBBAUD, OnSelchangeCmbbaud)
ON_BN_CLICKED(IDC_BTNOPEN, OnBtnopen)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CDlgSeriesSetup message handlers
void CDlgSeriesSetup::OnSelchangeCmbname()
{
// TODO: Add your control notification handler code here
switch (m_ComboComPort.GetCurSel())
{
case 0:
m_ComPort=1;
break;
case 1:
m_ComPort=2;
break;
case 2:
m_ComPort=3;
break;
case 3:
m_ComPort=4;
break;
case 4:
m_ComPort=5;
break;
case 5:
m_ComPort=6;
break;
case 6:
m_ComPort=7;
break;
case 7:
m_ComPort=8;
break;
case 8:
m_ComPort=9;
break;
}
}
void CDlgSeriesSetup::OnSelchangeCmbbaud()
{
// TODO: Add your control notification handler code here
switch (m_ComboBaudrate.GetCurSel())
{
case 0:
m_Baudrate=300;
break;
case 1:
m_Baudrate=600;
break;
case 2:
m_Baudrate=1200;
break;
case 3:
m_Baudrate=2400;
break;
case 4:
m_Baudrate=4800;
break;
case 5:
m_Baudrate=115200;
break;
case 6:
m_Baudrate=19200;
break;
case 7:
m_Baudrate=38400;
break;
case 8:
m_Baudrate=57600;
break;
case 9:
m_Baudrate=9600;
break;
}
}
BOOL CDlgSeriesSetup::OnInitDialog()
{
CDialog::OnInitDialog();
// TODO: Add extra initialization here
UpdateData();
CComboBox *pCmbName = NULL;
CComboBox *pCmbBaud = NULL;
pCmbName = (CComboBox*)GetDlgItem(IDC_CMBNAME);
pCmbBaud = (CComboBox*)GetDlgItem(IDC_CMBBAUD);
pCmbName->SetCurSel(0);
pCmbBaud->SetCurSel(5);
UpdateData(false);
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
void CDlgSeriesSetup::OnBtnopen()
{
// TODO: Add your control notification handler code here
OnOK();
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -