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

📄 setupnetdlg.cpp

📁 多线程串口通信的例子,可以实现同时多串口的通信
💻 CPP
字号:
// SetupNetDlg.cpp : implementation file
//

#include "stdafx.h"
#include "SerialTool.h"
#include "SetupNetDlg.h"
#include "SerialToolDlg.h"

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

/////////////////////////////////////////////////////////////////////////////
// CSetupNetDlg dialog


CSetupNetDlg::CSetupNetDlg(CWnd* pParent /*=NULL*/)
	: CDialog(CSetupNetDlg::IDD, pParent)
{
	//{{AFX_DATA_INIT(CSetupNetDlg)
	m_sIP = _T("");
	m_nPort = 0;
	//}}AFX_DATA_INIT
}


void CSetupNetDlg::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CSetupNetDlg)
	DDX_Text(pDX, IDC_EDIT_IP, m_sIP);
	DDX_Text(pDX, IDC_EDIT_PORT, m_nPort);
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CSetupNetDlg, CDialog)
	//{{AFX_MSG_MAP(CSetupNetDlg)
	ON_BN_CLICKED(IDC_BUT_SAVE, OnButSave)
	ON_BN_CLICKED(IDC_BUT_CANCEL, OnButCancel)
	ON_COMMAND(ID_MENUITEM_CLOSENET, OnMenuitemClosenet)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CSetupNetDlg message handlers

BOOL CSetupNetDlg::OnInitDialog() 
{
	CDialog::OnInitDialog();
	
	// TODO: Add extra initialization here
	
	CSerialToolDlg *pDlg;
    pDlg = (CSerialToolDlg *)AfxGetMainWnd();
	m_sIP=(CString)(pDlg->m_szIP);
	m_nPort = pDlg->m_nPort;
	UpdateData(FALSE);
	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}

void CSetupNetDlg::OnButSave() 
{
	// TODO: Add your control notification handler code here
	UpdateData(TRUE);
	CSerialToolDlg *pDlg;
    pDlg = (CSerialToolDlg *)AfxGetMainWnd();
	LPTSTR lpIP;
    lpIP = m_sIP.GetBuffer(m_sIP.GetLength());
	strcpy(pDlg->m_szIP,lpIP);
	pDlg->m_nPort = m_nPort;
	OnOK();

	
}

void CSetupNetDlg::OnButCancel() 
{
	// TODO: Add your control notification handler code here
	OnCancel();
}

void CSetupNetDlg::OnMenuitemClosenet() 
{
	// TODO: Add your command handler code here
	
}

⌨️ 快捷键说明

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