LAPTOP-SNT8I5JK\Boounion
2025-03-26 8942dacbc2bfaf8aec6a360671de20b0fbf32273
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#pragma once
#include "afxdialogex.h"
 
 
// CAddPLCInfo 对话框
 
class CAddPLCInfo : public CDialogEx
{
    DECLARE_DYNAMIC(CAddPLCInfo)
 
public:
    CAddPLCInfo(CWnd* pParent = nullptr);   // 标准构造函数
    virtual ~CAddPLCInfo();
 
    // 获取plc名称\ip\端口
    CString GetPLCName();
    CString GetIP();
    CString GetPort();
 
// 对话框数据
#ifdef AFX_DESIGN_TIME
    enum { IDD = IDD_DIALOG_ADD_PLC_INFO };
#endif
 
protected:
    virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV 支持
    afx_msg void OnBnClickedOk();
    DECLARE_MESSAGE_MAP()
 
private:
    bool IsValidPort(const CString& strPort);
    bool IsValidIPAddress(const CString& strIP1, const CString& strIP2, const CString& strIP3, const CString& strIP4);
    bool IsValidIPSegment(const CString& strSegment);
 
    // 数据
    CString m_strPLCName;
    CString m_strIP;
    CString m_strPort;
 
    // 控件
    CEdit m_editPLCName;
    CEdit m_editPort;
};