📄 comset.cpp
字号:
// ComSet.cpp : implementation file
//
#include "stdafx.h"
#include "myPager.h"
#include "ComSet.h"
#include "myPagerDlg.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
extern CMyPagerApp theApp;
/////////////////////////////////////////////////////////////////////////////
// CComSet dialog
CComSet::CComSet(CWnd* pParent /*=NULL*/)
: CDialog(CComSet::IDD, pParent)
{
//{{AFX_DATA_INIT(CComSet)
//}}AFX_DATA_INIT
}
void CComSet::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CComSet)
DDX_Control(pDX, IDC_COM_SPEED, m_cComSpeed);
DDX_Control(pDX, IDC_COM_NUM, m_cComSet);
DDX_Control(pDX, IDOK, m_cIDOK);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CComSet, CDialog)
//{{AFX_MSG_MAP(CComSet)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CComSet message handlers
BOOL CComSet::PreTranslateMessage(MSG* pMsg)
{
// TODO: Add your specialized code here and/or call the base class
if (pMsg->message==WM_KEYDOWN && pMsg->wParam==VK_RETURN)
{
CWnd* v_wCtrl=GetFocus(); //获得焦点
if (v_wCtrl==&m_cIDOK) //列表窗回车
{
OnOK();
return true;
}
CDialog* Pwnd=(CDialog*)GetActiveWindow(); //取得对话框指针
Pwnd->NextDlgCtrl(); //切换到下一个输入焦点
return true;
}
return CDialog::PreTranslateMessage(pMsg);
}
BOOL CComSet::OnInitDialog()
{
CDialog::OnInitDialog();
m_cComSet.SetCurSel(v_iComm); //初始化串口
m_cComSpeed.SetCurSel(v_iSpeed);//初始化串口速率
// TODO: Add extra initialization here
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
void CComSet::OnOK()
{
// TODO: Add extra validation here
v_iComm=m_cComSet.GetCurSel();
v_iSpeed=m_cComSpeed.GetCurSel();
CDialog::OnOK();
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -