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

📄 plcin2dlg.cpp

📁 波峰焊后台控制软件-英文版
💻 CPP
字号:
// PlcIn2Dlg.cpp : implementation file
//
#include "stdafx.h"
#include "resource.h"
#include "PlcIn2Dlg.h"
#include "FLADS.h"

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

/////////////////////////////////////////////////////////////////////////////
// CPlcIn2Dlg dialog

extern CFLADSApp theApp;
CPlcIn2Dlg::CPlcIn2Dlg(CWnd* pParent /*=NULL*/)
	: CDialog(CPlcIn2Dlg::IDD, pParent)
{
	//{{AFX_DATA_INIT(CPlcIn2Dlg)
		// NOTE: the ClassWizard will add member initialization here
	//}}AFX_DATA_INIT
}


void CPlcIn2Dlg::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CPlcIn2Dlg)
	DDX_Control(pDX, IDC_CHECK16, m_soepm);
	DDX_Control(pDX, IDC_CHECK15, m_dnmc);
	DDX_Control(pDX, IDC_CHECK14, m_upmc);
	DDX_Control(pDX, IDC_NOT_ENABLE, m_not);
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CPlcIn2Dlg, CDialog)
	//{{AFX_MSG_MAP(CPlcIn2Dlg)
	ON_BN_CLICKED(IDC_NOT_ENABLE, OnNotEnable)
	ON_EN_CHANGE(IDC_WEEK, OnChangeWeek)
	ON_EN_CHANGE(IDC_HOUR, OnChangeHour)
	ON_EN_CHANGE(IDC_MINUTE, OnChangeMinute)
	ON_EN_CHANGE(IDC_SECOND, OnChangeSecond)
	ON_EN_CHANGE(IDC_EDIT10, OnChangeEdit10)
	ON_BN_CLICKED(IDC_CHECK14, OnCheck14)
	ON_BN_CLICKED(IDC_CHECK15, OnCheck15)
	ON_BN_CLICKED(IDC_CHECK16, OnCheck16)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CPlcIn2Dlg message handlers

BOOL CPlcIn2Dlg::OnInitDialog() 
{
	CDialog::OnInitDialog();
	
	// TODO: Add extra initialization here
	int  i,j;
	CString  string;
	double  dx,dt;
	unsigned long  l;

	string.Format(_T("%03d输入类型"),theApp.krnum+1);
	SetDlgItemText(IDC_TYPE,string); 
   
    l=(unsigned long)theApp.yxtask.etime[theApp.krnum];
	j=l%60; l=l/60;
	string.Format(_T("%02d"),j);
	SetDlgItemText(IDC_SECOND,string); 
	second=j;

	j=l%60; l=l/60;
	string.Format(_T("%02d"),j);
	SetDlgItemText(IDC_MINUTE,string); 
	minute=j;

	j=l%24; l=l/24;
	string.Format(_T("%02d"),j);
	SetDlgItemText(IDC_HOUR,string); 
	hour=j;

	j=l%7;
	string.Format(_T("%02d"),j+1);
	SetDlgItemText(IDC_WEEK,string); 
	week=j;
    
    m_not.SetCheck((int)theApp.yxtask.con_in[theApp.krnum].B.kgbf);  

    j=theApp.yxtask.bvtm[theApp.krnum];
	string.Format(_T("%3d"),j);
    SetDlgItemText(IDC_EDIT10,string);

	m_upmc. SetCheck(theApp.yxtask.con_in[theApp.krnum].B.upm_enable);
	m_dnmc. SetCheck(theApp.yxtask.con_in[theApp.krnum].B.dnm_enable);
	m_soepm.SetCheck(theApp.yxtask.con_in[theApp.krnum].B.soe_enable);

    SetDlgItemText(IDC_README,theApp.Warninformatiom[theApp.krnum]); 
	
	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}

void CPlcIn2Dlg::OnNotEnable() 
{
	// TODO: Add your control notification handler code here
	if((m_not.GetCheck()%2)!=0)
	{
			m_not.SetCheck(1);	
		    theApp.yxtask.con_in[theApp.krnum].B.kgbf=1;
	}else
	{
			m_not.SetCheck(0);	
		    theApp.yxtask.con_in[theApp.krnum].B.kgbf=0;
	}	
}

void CPlcIn2Dlg::OnChangeWeek() 
{
	// TODO: If this is a RICHEDIT control, the control will not
	// send this notification unless you override the CDialog::OnInitDialog()
	// function to send the EM_SETEVENTMASK message to the control
	// with the ENM_CHANGE flag ORed into the lParam mask.
	
	// TODO: Add your control notification handler code here
	double  dx,dt;
    unsigned short wBuf[32];
	int j;


	GetDlgItemText(IDC_WEEK,wBuf,20);
	j=_wtoi(wBuf);
	if(j>7) j=7;
	if(j<=0) j=1;
    dx=(double)(j-1);
	dt=dx*24*3600;
	dx=(double)hour;   dx=dx*3600;  dt=dt+dx;
	dx=(double)minute; dx=dx*60;    dt=dt+dx;
	dx=(double)second;              dt=dt+dx;
	theApp.yxtask.etime[theApp.krnum]=dt;
}

void CPlcIn2Dlg::OnChangeHour() 
{
	// TODO: If this is a RICHEDIT control, the control will not
	// send this notification unless you override the CDialog::OnInitDialog()
	// function to send the EM_SETEVENTMASK message to the control
	// with the ENM_CHANGE flag ORed into the lParam mask.
	
	// TODO: Add your control notification handler code here
	double  dx,dt;
    unsigned short wBuf[32];
	int j;


	GetDlgItemText(IDC_HOUR,wBuf,20);
	j=_wtoi(wBuf);
	if(j>23) j=23;

	dt=0;
	dx=(double)week;   dx=dx*24*3600; dt=dt+dx;
	dx=(double)j;      dx=dx*3600;    dt=dt+dx;
	dx=(double)minute; dx=dx*60;      dt=dt+dx;
	dx=(double)second;                dt=dt+dx;
	theApp.yxtask.etime[theApp.krnum]=dt;
	
}

void CPlcIn2Dlg::OnChangeMinute() 
{
	// TODO: If this is a RICHEDIT control, the control will not
	// send this notification unless you override the CDialog::OnInitDialog()
	// function to send the EM_SETEVENTMASK message to the control
	// with the ENM_CHANGE flag ORed into the lParam mask.
	
	// TODO: Add your control notification handler code here
	double  dx,dt;
    unsigned short wBuf[32];
	int j;


	GetDlgItemText(IDC_MINUTE,wBuf,20);
	j=_wtoi(wBuf);
	if(j>59) j=59;

	dt=0;
	dx=(double)week;   dx=dx*24*3600; dt=dt+dx;
	dx=(double)hour;   dx=dx*3600;    dt=dt+dx;
	dx=(double)j;      dx=dx*60;      dt=dt+dx;
	dx=(double)second;                dt=dt+dx;
	theApp.yxtask.etime[theApp.krnum]=dt;
	
}

void CPlcIn2Dlg::OnChangeSecond() 
{
	// TODO: If this is a RICHEDIT control, the control will not
	// send this notification unless you override the CDialog::OnInitDialog()
	// function to send the EM_SETEVENTMASK message to the control
	// with the ENM_CHANGE flag ORed into the lParam mask.
	
	// TODO: Add your control notification handler code here
	double  dx,dt;
    unsigned short wBuf[32];
	int j;


	GetDlgItemText(IDC_SECOND,wBuf,20);
	j=_wtoi(wBuf);
	if(j>59) j=59;

	dt=0;
	dx=(double)week;   dx=dx*24*3600; dt=dt+dx;
	dx=(double)hour;   dx=dx*3600;    dt=dt+dx;
	dx=(double)minute; dx=dx*60;      dt=dt+dx;
	dx=(double)j;                     dt=dt+dx;
	theApp.yxtask.etime[theApp.krnum]=dt;
}

void CPlcIn2Dlg::OnChangeEdit10() 
{//滤波时间
	// TODO: If this is a RICHEDIT control, the control will not
	// send this notification unless you override the CDialog::OnInitDialog()
	// function to send the EM_SETEVENTMASK message to the control
	// with the ENM_CHANGE flag ORed into the lParam mask.
	
	// TODO: Add your control notification handler code here
    unsigned short wBuf[32];
	int j;
	CString  string;

	GetDlgItemText(IDC_EDIT10,wBuf,20);
	j=_wtoi(wBuf);
	theApp.yxtask.bvtm[theApp.krnum]=j;	
}

void CPlcIn2Dlg::OnCheck14() 
{//上升沿计数
	// TODO: Add your control notification handler code here
	if((m_upmc.GetCheck()%2)!=0)
	{
			m_upmc.SetCheck(1);
		    theApp.yxtask.con_in[theApp.krnum].B.upm_enable=1;
	}else
	{
			m_upmc.SetCheck(0);
		    theApp.yxtask.con_in[theApp.krnum].B.upm_enable=0;
	}	
}

void CPlcIn2Dlg::OnCheck15() 
{//下降沿计数
	// TODO: Add your control notification handler code here
	if((m_dnmc.GetCheck()%2)!=0)
	{
			m_dnmc.SetCheck(1);
		    theApp.yxtask.con_in[theApp.krnum].B.dnm_enable=1;
	}else
	{
			m_dnmc.SetCheck(0);
		    theApp.yxtask.con_in[theApp.krnum].B.dnm_enable=0;
	}	
}

void CPlcIn2Dlg::OnCheck16() 
{//SOE允许
	// TODO: Add your control notification handler code here
	if((m_soepm.GetCheck()%2)!=0)
	{
			m_soepm.SetCheck(1);
		    theApp.yxtask.con_in[theApp.krnum].B.soe_enable=1;
	}else
	{
			m_soepm.SetCheck(0);
		    theApp.yxtask.con_in[theApp.krnum].B.soe_enable=0;
	}	
}

⌨️ 快捷键说明

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