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

📄 helpfrmdlg.cpp

📁 操作系统是Windows 98
💻 CPP
字号:
// HelpFrmDlg.cpp : implementation file
//

#include "stdafx.h"
#include "VCStyle.h"
#include "HelpFrmDlg.h"

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

/////////////////////////////////////////////////////////////////////////////
// CHelpFrmDlg dialog


CHelpFrmDlg::CHelpFrmDlg(CWnd* pParent /*=NULL*/)
	: CDialog(CHelpFrmDlg::IDD, pParent)
{
	//{{AFX_DATA_INIT(CHelpFrmDlg)
	m_addr = 7;
	m_ch = 0;
	m_delay = 10;
	m_param = _T("");
	m_res = _T("");
	m_cmd = 1;
	//}}AFX_DATA_INIT
}


void CHelpFrmDlg::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CHelpFrmDlg)
	DDX_Text(pDX, IDC_EDIT_ADDR, m_addr);
	DDX_Text(pDX, IDC_EDIT_CH, m_ch);
	DDX_Text(pDX, IDC_EDIT_DELAY, m_delay);
	DDX_Text(pDX, IDC_EDIT_PARAM, m_param);
	DDX_Text(pDX, IDC_EDIT_RESULT, m_res);
	DDX_CBIndex(pDX, IDC_COMBO_CMD, m_cmd);
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CHelpFrmDlg, CDialog)
	//{{AFX_MSG_MAP(CHelpFrmDlg)
	ON_CBN_SELCHANGE(IDC_COMBO_CMD, OnSelchangeComboCmd)
	ON_EN_CHANGE(IDC_EDIT_DELAY, OnChangeEditDelay)
	ON_EN_CHANGE(IDC_EDIT_CH, OnChangeEditCh)
	ON_EN_CHANGE(IDC_EDIT_ADDR, OnChangeEditAddr)
	ON_EN_CHANGE(IDC_EDIT_PARAM, OnChangeEditParam)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CHelpFrmDlg message handlers

void CHelpFrmDlg::OnSelchangeComboCmd() 
{
	ShowRes();//显示结果
}

BYTE CHelpFrmDlg::Sel2Cmd(int sel)
{
	switch(sel){
	case 0://复位
		return 0;
	case 1://数据采集
		return 2;
	case 2://继电器
		return 8;
	default:
		return 0xff;//not use
	}
}

void CHelpFrmDlg::ShowRes()
{
	UpdateData();
	BYTE cmd = Sel2Cmd(m_cmd);
	BYTE param[6];
	for(int i=0;i<6;i++){
		param[i] = 0;
	}
	sscanf(m_param,"%2x %2x %2x %2x %2x %2x",&param[0],&param[1],&param[2],
		&param[3],&param[4],&param[5]);
	m_res.Format("%2x %2x %2x %2x %2x %2x %2x %2x %2x %2x %2x %2x",
		m_delay,8,m_addr,0,m_ch,cmd,param[0],param[1],param[2],param[3],param[4],param[5]);

	UpdateData(FALSE);
}

void CHelpFrmDlg::OnChangeEditDelay() 
{
	// TODO: If this is a RICHEDIT control, the control will not
	// send this notification unless you override the CDialog::OnInitDialog()
	// function and call CRichEditCtrl().SetEventMask()
	// with the ENM_CHANGE flag ORed into the mask.
	
	// TODO: Add your control notification handler code here
	ShowRes();//显示结果
	
}

void CHelpFrmDlg::OnChangeEditCh() 
{
	// TODO: If this is a RICHEDIT control, the control will not
	// send this notification unless you override the CDialog::OnInitDialog()
	// function and call CRichEditCtrl().SetEventMask()
	// with the ENM_CHANGE flag ORed into the mask.
	
	// TODO: Add your control notification handler code here
	ShowRes();//显示结果
	
}

void CHelpFrmDlg::OnChangeEditAddr() 
{
	// TODO: If this is a RICHEDIT control, the control will not
	// send this notification unless you override the CDialog::OnInitDialog()
	// function and call CRichEditCtrl().SetEventMask()
	// with the ENM_CHANGE flag ORed into the mask.
	
	// TODO: Add your control notification handler code here
	ShowRes();//显示结果
	
}

void CHelpFrmDlg::OnChangeEditParam() 
{
	// TODO: If this is a RICHEDIT control, the control will not
	// send this notification unless you override the CDialog::OnInitDialog()
	// function and call CRichEditCtrl().SetEventMask()
	// with the ENM_CHANGE flag ORed into the mask.
	
	// TODO: Add your control notification handler code here
	ShowRes();//显示结果
	
}

BOOL CHelpFrmDlg::OnInitDialog() 
{
	CDialog::OnInitDialog();
	
	// TODO: Add extra initialization here
	ShowRes();//显示结果

	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}

⌨️ 快捷键说明

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