提交 | 用户 | age
|
4b03ae
|
1 |
|
Q |
2 |
// MainFrm.cpp: CMainFrame 类的实现
|
|
3 |
//
|
|
4 |
|
|
5 |
#include "pch.h"
|
|
6 |
#include "framework.h"
|
|
7 |
#include "MultiTerminal2.h"
|
|
8 |
|
|
9 |
#include "MainFrm.h"
|
|
10 |
|
|
11 |
#ifdef _DEBUG
|
|
12 |
#define new DEBUG_NEW
|
|
13 |
#endif
|
|
14 |
|
|
15 |
// CMainFrame
|
|
16 |
|
|
17 |
IMPLEMENT_DYNAMIC(CMainFrame, CMDIFrameWnd)
|
|
18 |
|
|
19 |
BEGIN_MESSAGE_MAP(CMainFrame, CMDIFrameWnd)
|
|
20 |
ON_WM_CREATE()
|
|
21 |
|
|
22 |
ON_COMMAND(ID_UPLOAD_FROM_PLC, &CMainFrame::OnUploadFromPlc)
|
|
23 |
ON_COMMAND(ID_VIEW_FUNCKEY_BAR, &CMainFrame::OnViewFunckeyBar)
|
|
24 |
ON_UPDATE_COMMAND_UI(ID_VIEW_FUNCKEY_BAR, &CMainFrame::OnUpdateViewFunckeyBar)
|
|
25 |
ON_COMMAND(ID_VIEW_INPUT_BAR, &CMainFrame::OnViewInputBar)
|
|
26 |
ON_UPDATE_COMMAND_UI(ID_VIEW_INPUT_BAR, &CMainFrame::OnUpdateViewInputBar)
|
|
27 |
ON_COMMAND(ID_VIEW_NUMKEY_BAR, &CMainFrame::OnViewNumkeyBar)
|
|
28 |
ON_UPDATE_COMMAND_UI(ID_VIEW_NUMKEY_BAR, &CMainFrame::OnUpdateViewNumkeyBar)
|
|
29 |
ON_COMMAND(ID_VIEW_INPUTSEG_BAR, &CMainFrame::OnViewInputsegBar)
|
|
30 |
ON_UPDATE_COMMAND_UI(ID_VIEW_INPUTSEG_BAR, &CMainFrame::OnUpdateViewInputsegBar)
|
|
31 |
ON_COMMAND(ID_VIEW_COMMENTS_BAR, &CMainFrame::OnViewCommentsBar)
|
|
32 |
ON_UPDATE_COMMAND_UI(ID_VIEW_COMMENTS_BAR, &CMainFrame::OnUpdateViewCommentsBar)
|
|
33 |
END_MESSAGE_MAP()
|
|
34 |
|
|
35 |
static UINT indicators[] =
|
|
36 |
{
|
|
37 |
ID_SEPARATOR, // 状态行指示器
|
|
38 |
ID_INDICATOR_CAPS,
|
|
39 |
ID_INDICATOR_NUM,
|
|
40 |
ID_INDICATOR_SCRL,
|
|
41 |
};
|
|
42 |
|
|
43 |
// CMainFrame 构造/析构
|
|
44 |
|
|
45 |
CMainFrame::CMainFrame() noexcept
|
|
46 |
{
|
|
47 |
// TODO: 在此添加成员初始化代码
|
|
48 |
}
|
|
49 |
|
|
50 |
CMainFrame::~CMainFrame()
|
|
51 |
{
|
|
52 |
}
|
|
53 |
|
|
54 |
int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
|
|
55 |
{
|
|
56 |
if (CMDIFrameWnd::OnCreate(lpCreateStruct) == -1)
|
|
57 |
return -1;
|
|
58 |
|
|
59 |
if (!m_wndToolBar.CreateEx(this, TBSTYLE_FLAT, WS_CHILD | WS_VISIBLE | CBRS_TOP | CBRS_GRIPPER | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC) ||
|
|
60 |
!m_wndToolBar.LoadToolBar(IDR_MAINFRAME))
|
|
61 |
{
|
|
62 |
TRACE0("未能创建工具栏\n");
|
|
63 |
return -1; // 未能创建
|
|
64 |
}
|
|
65 |
|
|
66 |
if (!m_wndToolBar_Num.CreateEx(this, TBSTYLE_FLAT, WS_CHILD | WS_VISIBLE | CBRS_BOTTOM | CBRS_FLOAT_MULTI | CBRS_GRIPPER | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC) ||
|
|
67 |
!m_wndToolBar_Num.LoadToolBar(IDR_TOOLBAR_NUM))
|
|
68 |
{
|
|
69 |
TRACE0("未能创建数字工具栏\n");
|
|
70 |
return -1; // 未能创建
|
|
71 |
}
|
|
72 |
|
|
73 |
|
|
74 |
if (!m_wndStatusBar.Create(this))
|
|
75 |
{
|
|
76 |
TRACE0("未能创建状态栏\n");
|
|
77 |
return -1; // 未能创建
|
|
78 |
}
|
|
79 |
m_wndStatusBar.SetIndicators(indicators, sizeof(indicators)/sizeof(UINT));
|
|
80 |
|
|
81 |
// TODO: 如果不需要可停靠工具栏,则删除这三行
|
|
82 |
m_wndToolBar.EnableDocking(CBRS_ALIGN_ANY);
|
|
83 |
EnableDocking(CBRS_ALIGN_ANY);
|
|
84 |
DockControlBar(&m_wndToolBar);
|
|
85 |
|
|
86 |
m_wndToolBar_Num.EnableDocking(CBRS_ALIGN_ANY);
|
|
87 |
EnableDocking(CBRS_ALIGN_ANY);
|
|
88 |
DockControlBar(&m_wndToolBar_Num);
|
|
89 |
|
|
90 |
return 0;
|
|
91 |
}
|
|
92 |
|
|
93 |
BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs)
|
|
94 |
{
|
|
95 |
if( !CMDIFrameWnd::PreCreateWindow(cs) )
|
|
96 |
return FALSE;
|
|
97 |
// TODO: 在此处通过修改
|
|
98 |
// CREATESTRUCT cs 来修改窗口类或样式
|
|
99 |
|
|
100 |
return TRUE;
|
|
101 |
}
|
|
102 |
|
|
103 |
// CMainFrame 诊断
|
|
104 |
|
|
105 |
#ifdef _DEBUG
|
|
106 |
void CMainFrame::AssertValid() const
|
|
107 |
{
|
|
108 |
CMDIFrameWnd::AssertValid();
|
|
109 |
}
|
|
110 |
|
|
111 |
void CMainFrame::Dump(CDumpContext& dc) const
|
|
112 |
{
|
|
113 |
CMDIFrameWnd::Dump(dc);
|
|
114 |
}
|
|
115 |
#endif //_DEBUG
|
|
116 |
|
|
117 |
|
|
118 |
// CMainFrame 消息处理程序
|
|
119 |
|
|
120 |
|
|
121 |
|
|
122 |
void CMainFrame::OnUploadFromPlc()
|
|
123 |
{
|
|
124 |
// TODO: 在此添加命令处理程序代码
|
|
125 |
MessageBox(_T("From mainframe"));
|
|
126 |
|
|
127 |
}
|
|
128 |
|
|
129 |
|
|
130 |
void CMainFrame::OnViewFunckeyBar()
|
|
131 |
{
|
|
132 |
// TODO: 在此添加命令处理程序代码
|
|
133 |
}
|
|
134 |
|
|
135 |
|
|
136 |
void CMainFrame::OnUpdateViewFunckeyBar(CCmdUI *pCmdUI)
|
|
137 |
{
|
|
138 |
// TODO: 在此添加命令更新用户界面处理程序代码
|
|
139 |
}
|
|
140 |
|
|
141 |
|
|
142 |
void CMainFrame::OnViewInputBar()
|
|
143 |
{
|
|
144 |
// TODO: 在此添加命令处理程序代码
|
|
145 |
}
|
|
146 |
|
|
147 |
|
|
148 |
void CMainFrame::OnUpdateViewInputBar(CCmdUI *pCmdUI)
|
|
149 |
{
|
|
150 |
// TODO: 在此添加命令更新用户界面处理程序代码
|
|
151 |
}
|
|
152 |
|
|
153 |
|
|
154 |
void CMainFrame::OnViewNumkeyBar()
|
|
155 |
{
|
|
156 |
// TODO: 在此添加命令处理程序代码
|
|
157 |
}
|
|
158 |
|
|
159 |
|
|
160 |
void CMainFrame::OnUpdateViewNumkeyBar(CCmdUI *pCmdUI)
|
|
161 |
{
|
|
162 |
// TODO: 在此添加命令更新用户界面处理程序代码
|
|
163 |
}
|
|
164 |
|
|
165 |
|
|
166 |
void CMainFrame::OnViewInputsegBar()
|
|
167 |
{
|
|
168 |
// TODO: 在此添加命令处理程序代码
|
|
169 |
}
|
|
170 |
|
|
171 |
|
|
172 |
void CMainFrame::OnUpdateViewInputsegBar(CCmdUI *pCmdUI)
|
|
173 |
{
|
|
174 |
// TODO: 在此添加命令更新用户界面处理程序代码
|
|
175 |
}
|
|
176 |
|
|
177 |
|
|
178 |
void CMainFrame::OnViewCommentsBar()
|
|
179 |
{
|
|
180 |
// TODO: 在此添加命令处理程序代码
|
|
181 |
}
|
|
182 |
|
|
183 |
|
|
184 |
void CMainFrame::OnUpdateViewCommentsBar(CCmdUI *pCmdUI)
|
|
185 |
{
|
|
186 |
// TODO: 在此添加命令更新用户界面处理程序代码
|
|
187 |
}
|