📄 plcin3dlg.cpp
字号:
// PlcIn3Dlg.cpp : implementation file
//
#include "stdafx.h"
#include "resource.h"
#include "PlcIn3Dlg.h"
#include "FLADS.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CPlcIn3Dlg dialog
extern CFLADSApp theApp;
CPlcIn3Dlg::CPlcIn3Dlg(CWnd* pParent /*=NULL*/)
: CDialog(CPlcIn3Dlg::IDD, pParent)
{
//{{AFX_DATA_INIT(CPlcIn3Dlg)
// NOTE: the ClassWizard will add member initialization here
//}}AFX_DATA_INIT
}
void CPlcIn3Dlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CPlcIn3Dlg)
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(CPlcIn3Dlg, CDialog)
//{{AFX_MSG_MAP(CPlcIn3Dlg)
ON_EN_CHANGE(IDC_WEEK, OnChangeWeek)
ON_EN_CHANGE(IDC_HOUR, OnChangeHour)
ON_BN_CLICKED(IDC_NOT_ENABLE, OnNotEnable)
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()
/////////////////////////////////////////////////////////////////////////////
// CPlcIn3Dlg message handlers
BOOL CPlcIn3Dlg::OnInitDialog()
{
CDialog::OnInitDialog();
// TODO: Add extra initialization here
int i,j;
unsigned int ui;
CString string;
string.Format(_T("%03d输入类型"),theApp.krnum+1);
SetDlgItemText(IDC_TYPE,string);
m_not.SetCheck((int)theApp.yxtask.con_in[theApp.krnum].B.kgbf);
ui=theApp.yxtask.up_time[theApp.krnum];
string.Format(_T("%5d"),ui);
SetDlgItemText(IDC_WEEK,string);
ui=theApp.yxtask.dn_time[theApp.krnum];
string.Format(_T("%5d"),ui);
SetDlgItemText(IDC_HOUR,string);
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);
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
void CPlcIn3Dlg::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
unsigned short wBuf[32];
GetDlgItemText(IDC_WEEK,wBuf,20);
theApp.yxtask.up_time[theApp.krnum]=_wtoi(wBuf);
}
void CPlcIn3Dlg::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
unsigned short wBuf[32];
GetDlgItemText(IDC_HOUR,wBuf,20);
theApp.yxtask.dn_time[theApp.krnum]=_wtoi(wBuf);
}
void CPlcIn3Dlg::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 CPlcIn3Dlg::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 CPlcIn3Dlg::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 CPlcIn3Dlg::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 CPlcIn3Dlg::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 + -