ssdlg.cpp

来自「Visual C++串口通信技术与典型事例源代码串口调试精灵」· C++ 代码 · 共 81 行

CPP
81
字号
// SettingDlg.cpp : implementation file
//

#include "stdafx.h"
#include "CW.h"
#include "SSDlg.h"

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

/////////////////////////////////////////////////////////////////////////////
// CSSDlg dialog


CSSDlg::CSSDlg(CWnd* pParent /*=NULL*/)
	: CDialog(CSSDlg::IDD, pParent)
{
	nPort = 1;
	strSettings = _T("9600,n,8,1");
	strSendString = _T("");
	nTime = 1000;
	//{{AFX_DATA_INIT(CSSDlg)
	Port1 = 1;
	m_strSettings = _T("9600,n,8,1");
	m_strSendString = _T("");
	Time1 = 1000;
	//}}AFX_DATA_INIT
}


void CSSDlg::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CSSDlg)
	DDX_Text(pDX, IDC_COM, Port1);
	DDX_Text(pDX, IDC_COMSETTING, m_strSettings);
	DDX_Text(pDX, IDC_SENDSTRING, m_strSendString);
	DDX_Text(pDX, IDC_TIME, Time1);
	//}}AFX_DATA_MAP
}


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

/////////////////////////////////////////////////////////////////////////////
// CSSDlg message handlers

BOOL CSSDlg::OnInitDialog() 
{
	CDialog::OnInitDialog();
	
	// TODO: Add extra initialization here
	Port1 = nPort;
	Time1 = nTime;
	m_strSettings = strSettings;
	m_strSendString = strSendString;
	UpdateData(FALSE);
	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}

void CSSDlg::OnOK() 
{
	// TODO: Add extra validation here
	UpdateData(TRUE);

	nPort = Port1;
	nTime = Time1;
	strSettings = m_strSettings;
	strSendString = m_strSendString;

	UpdateData(FALSE);
	CDialog::OnOK();
}

⌨️ 快捷键说明

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