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

📄 dlgpollingmod.cpp

📁 一个canbus通讯软件源代码
💻 CPP
字号:
// DlgPollingMod.cpp : implementation file
//

#include "stdafx.h"
#include "test.h"
#include "DlgPollingMod.h"
#include "testDlg.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CDlgPollingMod dialog


CDlgPollingMod::CDlgPollingMod(CWnd* pParent /*=NULL*/)
	: CDialog(CDlgPollingMod::IDD, pParent)
{
	//{{AFX_DATA_INIT(CDlgPollingMod)
	m_wordIDChange = 0;
	m_wordInterval = 0;
	//}}AFX_DATA_INIT
}


void CDlgPollingMod::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CDlgPollingMod)
	DDX_Control(pDX, IDC_LIST_IDSHOW, m_ctrlistIDshow);
	DDX_Text(pDX, IDC_EDIT_SENDFRAMEID, m_wordIDChange);
	DDV_MinMaxDWord(pDX, m_wordIDChange, 0, 2000);
	DDX_Text(pDX, IDC_EDIT_INTERVAL, m_wordInterval);
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CDlgPollingMod, CDialog)
	//{{AFX_MSG_MAP(CDlgPollingMod)
	ON_BN_CLICKED(IDC_BUT_ADD, OnButAdd)
	ON_BN_CLICKED(IDC_BUT_DEL, OnButDel)
	ON_LBN_DBLCLK(IDC_LIST_IDSHOW, OnDblclkListIdshow)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CDlgPollingMod message handlers

void CDlgPollingMod::OnButAdd() 
{
	// TODO: Add your control notification handler code here
	UpdateData(true);
	CString strtempID,strtemplist;
	strtempID.Format("%ld",m_wordIDChange);
   for (int i=0;i<m_ctrlistIDshow.GetCount();i++)
   {
	   m_ctrlistIDshow.GetText(i,strtemplist);
       if (strtemplist.Compare(strtempID)==0)
       {
		   	strtempID.Format("Reader ID 为:%ld已经存在",m_wordIDChange);
		MessageBox(strtempID,"注意",MB_OK);
		return;
       }
   }

	m_ctrlistIDshow.AddString(strtempID);

}

void CDlgPollingMod::OnButDel() 
{
	// TODO: Add your control notification handler code here
	m_ctrlistIDshow.DeleteString(m_ctrlistIDshow.GetCurSel());
}

void CDlgPollingMod::OnDblclkListIdshow() 
{
	// TODO: Add your control notification handler code here
	OnButDel() ;
}

void CDlgPollingMod::GetParentDate()
{
	CString strtempID;
	CTestDlg * ptestdlg=(CTestDlg *)this->GetParent();
	for(int i=0;i<ptestdlg->m_wordPollingID.GetSize();i++)
	{
		strtempID.Format("%ld",ptestdlg->m_wordPollingID.GetAt(i));
		m_ctrlistIDshow.AddString(strtempID);

	}

}

BOOL CDlgPollingMod::OnInitDialog() 
{
	CDialog::OnInitDialog();
	
	// TODO: Add extra initialization here
	GetParentDate();
	m_wordIDChange=1;
	UpdateData(false);
	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}

void CDlgPollingMod::SetParentDate()
{
		CString strtempID;
	CTestDlg * ptestdlg=(CTestDlg *)this->GetParent();
	ptestdlg->m_wordPollingID.RemoveAll();
	for(int i=0;i<m_ctrlistIDshow.GetCount();i++)
	{
		m_ctrlistIDshow.GetText(i,strtempID);
		ptestdlg->m_wordPollingID.Add(atol(strtempID));

	}

}

void CDlgPollingMod::OnOK() 
{
	// TODO: Add extra validation here
	
SetParentDate();
	CDialog::OnOK();
}

⌨️ 快捷键说明

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