-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathNetSetDlg.cpp
76 lines (52 loc) · 1.25 KB
/
NetSetDlg.cpp
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
// NetSetDlg.cpp : 实现文件
//
#include "stdafx.h"
#include "Gobang.h"
#include "NetSetDlg.h"
#include "afxdialogex.h"
// NetSetDlg 对话框
IMPLEMENT_DYNAMIC(NetSetDlg, CDialogEx)
NetSetDlg::NetSetDlg(CWnd* pParent /*=NULL*/)
: CDialogEx(IDD_Setting, pParent)
, m_iPort(8000)
{
}
NetSetDlg::~NetSetDlg()
{
}
void NetSetDlg::DoDataExchange(CDataExchange* pDX)
{
CDialogEx::DoDataExchange(pDX);
DDX_Text(pDX, IDC_PortEdit, m_iPort);
DDV_MinMaxInt(pDX, m_iPort, 0, 8888);
DDX_Control(pDX, IDC_IPADDRESS1, m_ipCtrl);
DDX_Control(pDX, IDC_Host, m_radioHost);
}
BEGIN_MESSAGE_MAP(NetSetDlg, CDialogEx)
ON_BN_CLICKED(IDOK, &NetSetDlg::OnBnClickedOk)
END_MESSAGE_MAP()
// NetSetDlg 消息处理程序
void NetSetDlg::OnBnClickedOk()
{
BYTE field0, field1, field2, field3;
m_ipCtrl.GetAddress(field0, field1, field2, field3);
m_strIP.Format(_T("%d.%d.%d.%d"), field0, field1, field2, field3);
if (m_radioHost.GetCheck())
{
m_bHost = true;
}
else
{
m_bHost = false;
}
//AfxMessageBox(ip);
CDialogEx::OnOK();
}
BOOL NetSetDlg::OnInitDialog()
{
CDialogEx::OnInitDialog();
m_radioHost.SetCheck(TRUE);
m_ipCtrl.SetAddress(0x7F, 0x00, 0x00, 0x01);
return TRUE; // return TRUE unless you set the focus to a control
// 异常: OCX 属性页应返回 FALSE
}