dlggroupaddr.cpp

来自「串口收发工具」· C++ 代码 · 共 71 行

CPP
71
字号
// DlgGroupAddr.cpp : implementation file
//

#include "stdafx.h"
#include "maintain.h"
#include "DlgGroupAddr.h"
#include "mainfrm.h"

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

/////////////////////////////////////////////////////////////////////////////
// CDlgGroupAddr dialog


CDlgGroupAddr::CDlgGroupAddr(int i,int j,MODBUS_PARA p,CWnd* pParent /*=NULL*/)
	: CDialog(CDlgGroupAddr::IDD, pParent)
{
	//{{AFX_DATA_INIT(CDlgGroupAddr)
	m_Modbus_addr = p.start_addr;
	m_Modbus_ycCount = p.yccount;
	m_Modbus_yxCount = p.yxcount;
	//}}AFX_DATA_INIT
	m_Group = i;
	m_Adress = j;
	wndParent = pParent;
}


void CDlgGroupAddr::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CDlgGroupAddr)
	DDX_Text(pDX, IDC_EDIT_ADDR, m_Adress);
	DDV_MinMaxUInt(pDX, m_Adress, 0, 999);
	DDX_Text(pDX, IDC_EDIT_GROUP, m_Group);
	DDV_MinMaxUInt(pDX, m_Group, 0, 999);
	DDX_Text(pDX, IDC_MODBUS_ADDR, m_Modbus_addr);
	DDV_MinMaxUInt(pDX, m_Modbus_addr, 0, 65535);
	DDX_Text(pDX, IDC_MODBUS_YCCOUNT, m_Modbus_ycCount);
	DDV_MinMaxUInt(pDX, m_Modbus_ycCount, 0, 65535);
	DDX_Text(pDX, IDC_MODBUS_YXCOUNT, m_Modbus_yxCount);
	DDV_MinMaxUInt(pDX, m_Modbus_yxCount, 0, 65535);
	//}}AFX_DATA_MAP
}


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

/////////////////////////////////////////////////////////////////////////////
// CDlgGroupAddr message handlers

void CDlgGroupAddr::OnOK() 
{
	// TODO: Add extra validation here
	UpdateData(true);
	((CMainFrame*)AfxGetMainWnd())->SetGroupAddress(m_Group,m_Adress);
	MODBUS_PARA modbus;
	modbus.start_addr = m_Modbus_addr;
	modbus.yccount = m_Modbus_ycCount;
	modbus.yxcount = m_Modbus_yxCount;
	((CMainFrame*)AfxGetMainWnd())->SetModbusPara(modbus);
	CDialog::OnOK();
}

⌨️ 快捷键说明

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