提交 | 用户 | age
|
0ed438
|
1 |
// DialogSetData.cpp: 实现文件
|
Q |
2 |
//
|
|
3 |
|
|
4 |
#include "pch.h"
|
|
5 |
#include "MTerm2.h"
|
|
6 |
#include "DialogSetData.h"
|
|
7 |
#include "afxdialogex.h"
|
|
8 |
|
|
9 |
|
|
10 |
// CDialogSetData 对话框
|
|
11 |
|
|
12 |
IMPLEMENT_DYNAMIC(CDialogSetData, CDialogEx)
|
|
13 |
|
|
14 |
CDialogSetData::CDialogSetData(CWnd* pParent /*=nullptr*/)
|
|
15 |
: CDialogEx(IDD_DIALOG_SET_DATA, pParent)
|
|
16 |
{
|
|
17 |
|
|
18 |
}
|
|
19 |
|
|
20 |
CDialogSetData::~CDialogSetData()
|
|
21 |
{
|
|
22 |
}
|
|
23 |
|
|
24 |
void CDialogSetData::DoDataExchange(CDataExchange* pDX)
|
|
25 |
{
|
|
26 |
CDialogEx::DoDataExchange(pDX);
|
|
27 |
}
|
|
28 |
|
|
29 |
|
|
30 |
BEGIN_MESSAGE_MAP(CDialogSetData, CDialogEx)
|
|
31 |
END_MESSAGE_MAP()
|
|
32 |
|
|
33 |
|
|
34 |
// CDialogSetData 消息处理程序
|
|
35 |
|
|
36 |
BOOL CDialogSetData::OnInitDialog()
|
|
37 |
{
|
|
38 |
CDialogEx::OnInitDialog();
|
|
39 |
|
|
40 |
// TODO: 在此添加额外的初始化
|
|
41 |
ShowParams();
|
|
42 |
return false;
|
|
43 |
return TRUE; // return TRUE unless you set the focus to a control
|
|
44 |
// 异常: OCX 属性页应返回 FALSE
|
|
45 |
}
|
|
46 |
|
|
47 |
int CDialogSetData::ShowParams()
|
|
48 |
{
|
|
49 |
// TODO: 在此处添加实现代码.
|
|
50 |
CString s1;
|
|
51 |
s1 = _T("寄存器写入 ") + m_strAddr;
|
|
52 |
SetDlgItemText(IDC_STATIC_INFO, s1);
|
|
53 |
s1.Format(_T("%d"), m_nStat);
|
|
54 |
SetDlgItemText(IDC_EDIT_VALUE, s1);
|
|
55 |
|
|
56 |
GetDlgItem(IDC_EDIT_VALUE)->SetFocus();
|
|
57 |
((CEdit*)GetDlgItem(IDC_EDIT_VALUE))->SetSel(0, -1);
|
|
58 |
|
|
59 |
return 0;
|
|
60 |
}
|
|
61 |
|
|
62 |
|
|
63 |
int CDialogSetData::GetParams()
|
|
64 |
{
|
|
65 |
// TODO: 在此处添加实现代码.
|
|
66 |
CString s1;
|
|
67 |
GetDlgItemText(IDC_EDIT_VALUE, s1);
|
|
68 |
m_nStat = _tstoi(s1);
|
|
69 |
return 0;
|
|
70 |
}
|
|
71 |
|
|
72 |
void CDialogSetData::OnOK()
|
|
73 |
{
|
|
74 |
// TODO: 在此添加专用代码和/或调用基类
|
|
75 |
GetParams();
|
|
76 |
CDialogEx::OnOK();
|
|
77 |
}
|