// DialogSetCoil.cpp: 实现文件 // #include "pch.h" #include "MTerm1.h" #include "DialogSetCoil.h" #include "afxdialogex.h" // CDialogSetCoil 对话框 IMPLEMENT_DYNAMIC(CDialogSetCoil, CDialogEx) CDialogSetCoil::CDialogSetCoil(CWnd* pParent /*=nullptr*/) : CDialogEx(IDD_DIALOG_SET_COIL, pParent) { } CDialogSetCoil::~CDialogSetCoil() { } void CDialogSetCoil::DoDataExchange(CDataExchange* pDX) { CDialogEx::DoDataExchange(pDX); } BEGIN_MESSAGE_MAP(CDialogSetCoil, CDialogEx) END_MESSAGE_MAP() // CDialogSetCoil 消息处理程序 BOOL CDialogSetCoil::OnInitDialog() { CDialogEx::OnInitDialog(); // TODO: 在此添加额外的初始化 ShowParams(); return TRUE; // return TRUE unless you set the focus to a control // 异常: OCX 属性页应返回 FALSE } int CDialogSetCoil::ShowParams() { // TODO: 在此处添加实现代码. CString s1; s1 = _T("触点写入 ") + m_strAddr; SetDlgItemText(IDC_STATIC_INFO, s1); if (m_nStat) { ((CButton *)GetDlgItem(IDC_RADIO_SET_ON))->SetCheck(0); ((CButton *)GetDlgItem(IDC_RADIO_SET_OFF))->SetCheck(1); } else { ((CButton *)GetDlgItem(IDC_RADIO_SET_ON))->SetCheck(1); ((CButton *)GetDlgItem(IDC_RADIO_SET_OFF))->SetCheck(0); } return 0; } int CDialogSetCoil::GetParams() { // TODO: 在此处添加实现代码. int j= ((CButton *)GetDlgItem(IDC_RADIO_SET_ON))->GetCheck(); m_nStat = j; return 0; } void CDialogSetCoil::OnOK() { // TODO: 在此添加专用代码和/或调用基类 GetParams(); CDialogEx::OnOK(); }