QuakeGod
2023-09-05 df03213660361b1c771f0a3f21b6ddaeaef7763a
提交 | 用户 | age
df0321 1 // MyFormLog.cpp : 实现文件
Q 2 //
3
4 #include "pch.h"
5 #include "MTerm1.h"
6 #include "MyFormInputShow.h"
7
8
9 #include "MainFrm.h"
10
11 // CMyFormLog
12 structButton myButtons[6][3][11] =
13 {
14     {{33101,_T("-|  |-"), 33102,_T("└┤├┘") ,33103,_T("|"), 33104,_T("-[OUT]") ,33105,_T("TM/CT") ,33106,_T("Fun") ,33107,_T("——") ,33108,_T("NOT/") ,33109,_T("INDEX") ,33110,_T("(MC)") ,33111,_T("(MCE)") },
15     {33201,_T("-<SET>-"), 33202,_T("-<RESET>") ,33203,_T("(DF(/))"), 33204,_T("(END)") ,33205,_T("比较") ,33206,_T("PFun") ,33207,_T("↑↓") ,33208,_T("[位]") ,33209,_T("[字]") ,33210,_T("指令1") ,33211,_T("指令2") },
16     {33301,_T("PG转换"), 33302,_T("在线") ,33303,_T("离线"), 33304,_T("关闭") ,33305,_T("查找") ,33306,_T("次Win") ,33307,_T("监控Go") ,33308,_T("状态") ,33309,_T("Run/Prog") ,33310,_T("PLC读取") ,33311,_T("PLC写入") } },
17
18     {{33401,_T("X"), 33402,_T("Y") ,33403,_T("R"), 33404,_T("L") ,33405,_T("P") ,33406,_T("比较") ,33407,_T("") ,33408,_T("NOT/") ,33409,_T("INDEX") ,33410,_T("No.清除") ,33411,_T("") },
19     {33501,_T("T"), 33502,_T("C") ,33503,_T("E"), 33504,_T("") ,33505,_T("") ,33506,_T("") ,33507,_T("↑↓") ,33508,_T("") ,33509,_T("") ,33510,_T("") ,33511,_T("") },
20     {33601,_T(""), 33602,_T("") ,33603,_T(""), 33604,_T("") ,33605,_T("") ,33606,_T("") ,33607,_T("") ,33608,_T("") ,33609,_T("") ,33610,_T("") ,33611,_T("") }},
21
22     {{33701,_T("D"), 33702,_T("F") ,33703,_T(""), 33704,_T("") ,33705,_T("") ,33706,_T("=") ,33707,_T(">") ,33708,_T("<") ,33709,_T("") ,33710,_T("") ,33711,_T("") },
23     {33801,_T(""), 33802,_T("") ,33803,_T(""), 33804,_T("") ,33805,_T("") ,33806,_T("") ,33807,_T("") ,33808,_T("") ,33809,_T("") ,33810,_T("") ,33811,_T("") },
24     {33901,_T(""), 33902,_T("") ,33903,_T(""), 33904,_T("") ,33905,_T("") ,33906,_T("") ,33907,_T("") ,33908,_T("") ,33909,_T("") ,33910,_T("") ,33911,_T("") }},
25
26     {{34101,_T("WX"), 34102,_T("WY") ,34103,_T("WR"), 34104,_T("WL") ,34105,_T("DT") ,34106,_T("LD") ,34107,_T("FL") ,34108,_T("") ,34109,_T("INDEX") ,34110,_T("No.清除") ,34111,_T("") },
27     {34201,_T("SV"), 34202,_T("EV") ,34203,_T("K"), 34204,_T("H") ,34205,_T("M") ,34206,_T("f") ,34207,_T("") ,34208,_T("") ,34209,_T("") ,34210,_T("") ,34211,_T("") },
28     {34301,_T("PG转换"), 34302,_T("") ,34303,_T(""), 34304,_T("") ,34305,_T("") ,34306,_T("") ,34307,_T("") ,34308,_T("") ,34309,_T("") ,34310,_T("") ,34311,_T("") }},
29
30     {{34401,_T("IX(I0)"), 34402,_T("IY(I1)") ,34403,_T("I2"), 34404,_T("I3") ,34405,_T("I4") ,34406,_T("I5") ,34407,_T("I6") ,34408,_T("I7") ,34409,_T("I8") ,34410,_T("") ,34411,_T("") },
31     {34501,_T("I9"), 34502,_T("IA") ,34503,_T("IB"), 34504,_T("IC") ,34505,_T("ID") ,34506,_T("") ,34507,_T("↑↓") ,34508,_T("") ,34509,_T("") ,34510,_T("") ,34511,_T("") },
32     {34601,_T(""), 34602,_T("") ,34603,_T(""), 34604,_T("") ,34605,_T("") ,34606,_T("") ,34607,_T("") ,34608,_T("") ,34609,_T("") ,34610,_T("") ,34611,_T("") }},
33
34     {{34701,_T("TMX"), 34702,_T("TMY") ,34703,_T("TMR"), 34704,_T("TML") ,34705,_T("") ,34706,_T("-[CT]-") ,34707,_T("") ,34708,_T("") ,34709,_T("INDEX") ,34710,_T("") ,34711,_T("") },
35     {34801,_T(""), 34802,_T("") ,34803,_T(""), 34804,_T("") ,34805,_T("") ,34806,_T("") ,34807,_T("") ,34808,_T("") ,34809,_T("") ,34810,_T("") ,34811,_T("") },
36     {34901,_T(""), 34902,_T("") ,34903,_T(""), 34904,_T("") ,34905,_T("") ,34906,_T("") ,34907,_T("") ,34908,_T("") ,34909,_T("") ,3490,_T("") ,34911,_T("") }},
37 };
38
39 static int myButtonCount = sizeof(myButtons[6][3][11]) / sizeof(structButton);
40
41 structButton myNumButtons[18] =
42 {
43     ID_BUTTON_0,_T("0"), ID_BUTTON_1,_T("1") ,ID_BUTTON_2,_T("2"), ID_BUTTON_3,_T("3") ,ID_BUTTON_4,_T("4") ,ID_BUTTON_5,_T("5") ,ID_BUTTON_6,_T("6") ,ID_BUTTON_7,_T("7") ,
44     ID_BUTTON_8,_T("8") ,ID_BUTTON_9,_T("9") ,ID_BUTTON_A,_T("A"),ID_BUTTON_B,_T("B"),ID_BUTTON_C,_T("C"),ID_BUTTON_D,_T("D"),ID_BUTTON_E,_T("E"),ID_BUTTON_F,_T("F"),
45     ID_BUTTON_MINUS,_T("-"),ID_BUTTON_DOT,_T(".")
46 };
47
48 static int myNumButtonCount = sizeof(myNumButtons) / sizeof(structButton);
49
50 structButton myCmdButtons[4] =
51 {
52     ID_BUTTON_RET, _T("↙"), ID_BUTTON_INSERT, _T("Ins"), ID_BUTTON_DELETE, _T("Del"), ID_BUTTON_ESC, _T("Esc")
53 };
54 static int myCmdButtonCount = sizeof(myCmdButtons) / sizeof(structButton);
55
56
57 IMPLEMENT_DYNCREATE(CMyFormInputShow, CFormView)
58
59 CMyFormInputShow::CMyFormInputShow()
60     : CFormView(CMyFormInputShow::IDD)
61 {
62
63 }
64
65 CMyFormInputShow::~CMyFormInputShow()
66 {
67 }
68
69 void CMyFormInputShow::DoDataExchange(CDataExchange* pDX)
70 {
71     CFormView::DoDataExchange(pDX);
72     DDX_Control(pDX, IDC_EDIT_INPUT, m_edit_input);
73 }
74
75 BEGIN_MESSAGE_MAP(CMyFormInputShow, CFormView)
76     ON_WM_CREATE()
77     ON_WM_DESTROY()
78     ON_WM_SIZE()
79     ON_WM_MOUSEACTIVATE()
80     ON_WM_TIMER()
81
82     ON_BN_CLICKED(IDC_BUTTON1, &CMyFormInputShow::OnBnClickedButton1)
83
84     ON_BN_CLICKED(IDC_BUTTON_AND, &CMyFormInputShow::OnBnClickedBtnAnd)
85     ON_BN_CLICKED(IDC_BUTTON_OR, &CMyFormInputShow::OnBnClickedBtnOr)
86     ON_BN_CLICKED(IDC_BUTTON_VLINE, &CMyFormInputShow::OnBnClickedBtnVline)
87     ON_BN_CLICKED(IDC_BUTTON_OUT, &CMyFormInputShow::OnBnClickedBtnOut)
88     ON_BN_CLICKED(IDC_BUTTON_TMCT, &CMyFormInputShow::OnBnClickedBtnTmCt)
89     ON_BN_CLICKED(IDC_BUTTON_FUN, &CMyFormInputShow::OnBnClickedBtnFun)
90     ON_BN_CLICKED(IDC_BUTTON_HLINE, &CMyFormInputShow::OnBnClickedBtnHLine)
91     ON_BN_CLICKED(IDC_BUTTON_NOT, &CMyFormInputShow::OnBnClickedBtnNot)
92     ON_BN_CLICKED(IDC_BUTTON_INDEX, &CMyFormInputShow::OnBnClickedBtnIndex)
93     ON_BN_CLICKED(IDC_BUTTON_MC, &CMyFormInputShow::OnBnClickedBtnMc)
94     ON_BN_CLICKED(IDC_BUTTON_MCE, &CMyFormInputShow::OnBnClickedBtnMce)
95
96     ON_BN_CLICKED(IDC_BUTTON_SET, &CMyFormInputShow::OnBnClickedBtnSet)
97     ON_BN_CLICKED(IDC_BUTTON_RESET, &CMyFormInputShow::OnBnClickedBtnReset)
98     ON_BN_CLICKED(IDC_BUTTON_DF, &CMyFormInputShow::OnBnClickedBtnDf)
99     ON_BN_CLICKED(IDC_BUTTON_END, &CMyFormInputShow::OnBnClickedBtnEnd)
100     ON_BN_CLICKED(IDC_BUTTON_COMPARE, &CMyFormInputShow::OnBnClickedBtnCompare)
101     ON_BN_CLICKED(IDC_BUTTON_PFUN, &CMyFormInputShow::OnBnClickedBtnPFun)
102     ON_BN_CLICKED(IDC_BUTTON_UPDOWN, &CMyFormInputShow::OnBnClickedBtnUpDown)
103     ON_BN_CLICKED(IDC_BUTTON_BIT, &CMyFormInputShow::OnBnClickedBtnBit)
104     ON_BN_CLICKED(IDC_BUTTON_WORD, &CMyFormInputShow::OnBnClickedBtnWord)
105     ON_BN_CLICKED(IDC_BUTTON_INSTRUCTION1, &CMyFormInputShow::OnBnClickedBtnInc1)
106     ON_BN_CLICKED(IDC_BUTTON_INSTRUCTION2, &CMyFormInputShow::OnBnClickedBtnInc2)
107
108     ON_BN_CLICKED(IDC_BUTTON_PGCONVERT, &CMyFormInputShow::OnBnClickedBtnPgConvert)
109     ON_BN_CLICKED(IDC_BUTTON_ONLINE, &CMyFormInputShow::OnBnClickedBtnOnline)
110     ON_BN_CLICKED(IDC_BUTTON_OFFLINE, &CMyFormInputShow::OnBnClickedBtnOffline)
111     ON_BN_CLICKED(IDC_BUTTON_COLSE, &CMyFormInputShow::OnBnClickedBtnClose)
112     ON_BN_CLICKED(IDC_BUTTON_FIND, &CMyFormInputShow::OnBnClickedBtnFind)
113     ON_BN_CLICKED(IDC_BUTTON_NEXTWIN, &CMyFormInputShow::OnBnClickedBtnNextWin)
114     ON_BN_CLICKED(IDC_BUTTON_MONITOR, &CMyFormInputShow::OnBnClickedBtnMonitor)
115     ON_BN_CLICKED(IDC_BUTTON_STATUS, &CMyFormInputShow::OnBnClickedBtnStatus)
116     ON_BN_CLICKED(IDC_BUTTON_RUNPROG, &CMyFormInputShow::OnBnClickedBtnRunProg)
117     ON_BN_CLICKED(IDC_BUTTON_PLCREAD, &CMyFormInputShow::OnBnClickedBtnPlcRead)
118     ON_BN_CLICKED(IDC_BUTTON_PLCWRITE, &CMyFormInputShow::OnBnClickedBtnPlcWrite)
119
120     ON_BN_CLICKED(IDC_BUTTON_X, &CMyFormInputShow::OnBnClickedBtnX)
121     ON_BN_CLICKED(IDC_BUTTON_Y, &CMyFormInputShow::OnBnClickedBtnY)
122     ON_BN_CLICKED(IDC_BUTTON_R, &CMyFormInputShow::OnBnClickedBtnR)
123     ON_BN_CLICKED(IDC_BUTTON_L, &CMyFormInputShow::OnBnClickedBtnL)
124     ON_BN_CLICKED(IDC_BUTTON_P, &CMyFormInputShow::OnBnClickedBtnP)
125     ON_BN_CLICKED(IDC_BUTTON_COMPARE1, &CMyFormInputShow::OnBnClickedBtnCompare1)
126     ON_BN_CLICKED(IDC_BUTTON_NOT1, &CMyFormInputShow::OnBnClickedBtnNot)
127     ON_BN_CLICKED(IDC_BUTTON_T, &CMyFormInputShow::OnBnClickedBtnT)
128     ON_BN_CLICKED(IDC_BUTTON_C, &CMyFormInputShow::OnBnClickedBtnC)
129     ON_BN_CLICKED(IDC_BUTTON_E, &CMyFormInputShow::OnBnClickedBtnE)
130     ON_BN_CLICKED(IDC_BUTTON_UPDOWN1, &CMyFormInputShow::OnBnClickedBtnUpDown)
131
132     ON_BN_CLICKED(IDC_BUTTON_TMX, &CMyFormInputShow::OnBnClickedBtnTmx)
133     ON_BN_CLICKED(IDC_BUTTON_TMY, &CMyFormInputShow::OnBnClickedBtnTmy)
134     ON_BN_CLICKED(IDC_BUTTON_TMR, &CMyFormInputShow::OnBnClickedBtnTmr)
135     ON_BN_CLICKED(IDC_BUTTON_TML, &CMyFormInputShow::OnBnClickedBtnTml)
136     ON_BN_CLICKED(IDC_BUTTON_CT, &CMyFormInputShow::OnBnClickedBtnCt)
137
138     ON_BN_CLICKED(IDC_BUTTON_D, &CMyFormInputShow::OnBnClickedBtnD)
139     ON_BN_CLICKED(IDC_BUTTON_F, &CMyFormInputShow::OnBnClickedBtnF)
140     ON_BN_CLICKED(IDC_BUTTON_NEQ, &CMyFormInputShow::OnBnClickedBtnNEQ)
141     ON_BN_CLICKED(IDC_BUTTON_GT, &CMyFormInputShow::OnBnClickedBtnGT)
142     ON_BN_CLICKED(IDC_BUTTON_LT, &CMyFormInputShow::OnBnClickedBtnLT)
143
144     ON_BN_CLICKED(ID_BUTTON_0, &CMyFormInputShow::OnBtn0)
145     ON_BN_CLICKED(ID_BUTTON_1, &CMyFormInputShow::OnBtn1)
146     ON_BN_CLICKED(ID_BUTTON_2, &CMyFormInputShow::OnBtn2)
147     ON_BN_CLICKED(ID_BUTTON_3, &CMyFormInputShow::OnBtn3)
148     ON_BN_CLICKED(ID_BUTTON_4, &CMyFormInputShow::OnBtn4)
149     ON_BN_CLICKED(ID_BUTTON_5, &CMyFormInputShow::OnBtn5)
150     ON_BN_CLICKED(ID_BUTTON_6, &CMyFormInputShow::OnBtn6)
151     ON_BN_CLICKED(ID_BUTTON_7, &CMyFormInputShow::OnBtn7)
152     ON_BN_CLICKED(ID_BUTTON_8, &CMyFormInputShow::OnBtn8)
153     ON_BN_CLICKED(ID_BUTTON_9, &CMyFormInputShow::OnBtn9)
154     ON_BN_CLICKED(ID_BUTTON_A, &CMyFormInputShow::OnBtnA)
155     ON_BN_CLICKED(ID_BUTTON_B, &CMyFormInputShow::OnBtnB)
156     ON_BN_CLICKED(ID_BUTTON_C, &CMyFormInputShow::OnBtnC)
157     ON_BN_CLICKED(ID_BUTTON_D, &CMyFormInputShow::OnBtnD)
158     ON_BN_CLICKED(ID_BUTTON_E, &CMyFormInputShow::OnBtnE)
159     ON_BN_CLICKED(ID_BUTTON_F, &CMyFormInputShow::OnBtnF)
160     ON_BN_CLICKED(ID_BUTTON_MINUS, &CMyFormInputShow::OnBtnMinus)
161     ON_BN_CLICKED(ID_BUTTON_DOT, &CMyFormInputShow::OnBtnDot)
162     ON_BN_CLICKED(ID_BUTTON_RET, &CMyFormInputShow::OnBtnRet)
163     ON_BN_CLICKED(ID_BUTTON_INSERT, &CMyFormInputShow::OnBtnInsert)
164     ON_BN_CLICKED(ID_BUTTON_DELETE, &CMyFormInputShow::OnBtnDelete)
165     ON_BN_CLICKED(ID_BUTTON_ESC, &CMyFormInputShow::OnBtnEsc)
166
167
168     ON_WM_CHAR()
169 END_MESSAGE_MAP()
170
171
172 // CMyFormLog 诊断
173
174 #ifdef _DEBUG
175 void CMyFormInputShow::AssertValid() const
176 {
177     CFormView::AssertValid();
178 }
179
180 #ifndef _WIN32_WCE
181 void CMyFormInputShow::Dump(CDumpContext& dc) const
182 {
183     CFormView::Dump(dc);
184 }
185 #endif
186 #endif //_DEBUG
187
188
189 // CMyFormLog 消息处理程序
190
191
192 BOOL CMyFormInputShow::Create(LPCTSTR lpszClassName, LPCTSTR lpszWindowName, DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID, CCreateContext* pContext)
193 {
194     // TODO: 在此添加专用代码和/或调用基类
195
196     return CFormView::Create(lpszClassName, lpszWindowName, dwStyle, rect, pParentWnd, nID, pContext);
197 }
198
199
200 int CMyFormInputShow::OnCreate(LPCREATESTRUCT lpCreateStruct)
201 {
202     if (CFormView::OnCreate(lpCreateStruct) == -1)
203         return -1;
204
205     // TODO:  在此添加您专用的创建代码
206
207     return 0;
208 }
209
210
211 void CMyFormInputShow::OnDestroy()
212 {
213     CFormView::OnDestroy();
214
215     // TODO: 在此处添加消息处理程序代码
216 }
217
218
219 void CMyFormInputShow::OnSize(UINT nType, int cx, int cy)
220 {
221     CFormView::OnSize(nType, cx, cy);
222     // TODO: 在此处添加消息处理程序代码
223     CWnd * pwnd;
224 /*
225     pwnd=GetDlgItem(IDC_EDIT_LOG);
226     if (pwnd!=NULL)
227     {
228 //        RECT    rect1;
229         pwnd->SetWindowPos(NULL,0,0,cx,cy-20,NULL);
230     }
231 //*/
232
233 /*
234     pwnd = GetDlgItem(IDC_RICHEDIT2_LOG);
235     if (pwnd != NULL)
236     {
237         //        RECT    rect1;
238         pwnd->SetWindowPos(NULL, 0, 0, cx, cy - 20, NULL);
239     }
240     pwnd=GetDlgItem(IDC_CHECK_PAUSE);
241     if (pwnd!=NULL)
242     {
243         //RECT    rect1;
244         CRect rect1;
245         pwnd->GetWindowRect(rect1);
246         ScreenToClient(&rect1);
247         pwnd->SetWindowPos(NULL,0, cy - rect1.Height()-4,rect1.Width(),rect1.Height(),NULL);
248     }
249     pwnd=GetDlgItem(IDC_CHECK_NOSCROLL);
250     if (pwnd!=NULL)
251     {
252         CRect rect1;
253         pwnd->GetWindowRect(rect1);
254         ScreenToClient(&rect1);
255         pwnd->SetWindowPos(NULL,cx-rect1.Width(),cy-rect1.Height()-4,rect1.Width(),rect1.Height(),NULL);
256     }
257 //*/
258
259 }
260
261
262 void CMyFormInputShow::OnInitialUpdate()
263 {
264     CFormView::OnInitialUpdate();
265 /*
266     CString VersionStr = _T("V1.02");
267     CString BuildStr = _T("20210728");
268     // TODO: 在此添加专用代码和/或调用基类
269     myLogger1.SetLogPathName(_T("D:\\Logs\\MTerm1"), _T("MTerm1"));
270     myLogger1.AttachWnd(m_richedit_log.m_hWnd);
271     myLogger1.bShowLog[0] = 1;
272     myLogger1.bShowThreadId = 0;
273     myLogger1.bShowChannel = 0;
274     myLogger1.bSaveLog[0] = 1;
275     myLogger1.bShowDate = 1;
276     SysLog(_T(" Start ") + VersionStr + _T(" ") + BuildStr + _T("\r\n"));
277     myLogger1.bShowDate = 0;
278 //    myLogger1.bShowLineCount=0;
279 //    myLogger1.bShowTime=0;
280     myLogger1.UpdateLogDisplay();
281     SetTimer(1, 100, NULL);
282 */
283
284     CString(s1);
285
286     s1.Format(_T(" MyDlgBarFuncKey Onupdate "));
287     SysLog(s1);
288
289 //    LRESULT bRet = HandleInitDialog(wParam, lParam);
290 //    if (!UpdateData(FALSE))
291 //    {
292 //        TRACE("InitDialogBar Failed!");
293 //    }
294
295     CRect rect0;
296     GetClientRect(&rect0);
297     int nWidth = rect0.Width();
298     int nHeight = rect0.Height();
299     nWidth = 720; // rect0.Width();
300     nHeight = 60;
301     int nTopMargin = 32;
302     s1.Format(_T("Width %d Height %d "), nWidth, nHeight);
303     SysLog(s1);
304     int nLeftMargin = 48;
305
306     int nSpace = nWidth - nLeftMargin;
307     int x1, y1, x2, y2;
308     CRect rect1(0, 20, 300, 40);
309     for (int i = 0; i < myNumButtonCount; i++) {
310         x1 = nLeftMargin * 3 + i * (nSpace - nLeftMargin * 2) / 24;
311         y1 = 2;
312         x2 = x1 + (nSpace - nLeftMargin * 2) / 24 -2;
313         y2 = y1 + nHeight / 3;
314         rect1.SetRect(x1, y1, x2, y2);
315         m_NumButtons[i].Create(myNumButtons[i].sCaption, BS_FLAT | WS_CHILD | WS_TABSTOP | WS_VISIBLE | BS_PUSHBUTTON, rect1, this, myNumButtons[i].nID);
316         m_NumButtons[i].ShowWindow(SW_SHOW);
317     }
318
319     for (int i = 0; i < myCmdButtonCount; i++) {
320         x1 = nLeftMargin * 3 + (i +16) * (nSpace - nLeftMargin * 2) / 20;
321         y1 = 2;
322         x2 = x1 + nSpace / 24;
323         y2 = y1 + nHeight / 3;
324         rect1.SetRect(x1, y1, x2, y2);
325         m_CmdButtons[i].Create(myCmdButtons[i].sCaption, BS_FLAT | WS_CHILD | WS_TABSTOP | WS_VISIBLE | BS_PUSHBUTTON, rect1, this, myCmdButtons[i].nID);
326         m_CmdButtons[i].ShowWindow(SW_SHOW);
327     }
328     //    font1.CreatePointFont(95, _T("楷体"));
329     for (int i = 0; i < m_Lines; i++) {
330         for (int j = 0; j < 11; j++) {
331             x1 = nLeftMargin + j * nSpace / 11;
332             y1 = nTopMargin + i * nHeight / 3;
333             x2 = x1 + nSpace / 11;
334             y2 = y1 + nHeight / 3;
335             rect1.SetRect(x1, y1, x2, y2);
336             m_buttons[0][i][j].Create(myButtons[0][i][j].sCaption, BS_FLAT | WS_CHILD | WS_TABSTOP | WS_VISIBLE | BS_PUSHBUTTON, rect1, this, myButtons[0][i][j].nID);
337             m_buttons[0][i][j].ShowWindow(SW_SHOW);
338             //            init;
339         }
340     }
341     for (int i = 0; i < m_Lines; i++) {
342         for (int j = 0; j < 11; j++) {
343             x1 = nLeftMargin + j * nSpace / 11;
344             y1 = nTopMargin + i * nHeight / 3;
345             x2 = x1 + nSpace / 11;
346             y2 = y1 + nHeight / 3;
347             rect1.SetRect(x1, y1, x2, y2);
348             m_buttons[1][i][j].Create(myButtons[1][i][j].sCaption, BS_FLAT | WS_CHILD | WS_TABSTOP | BS_PUSHBUTTON, rect1, this, myButtons[1][i][j].nID);
349             //            bit;
350         }
351     }
352     for (int i = 0; i < m_Lines; i++) {
353         for (int j = 0; j < 11; j++) {
354             x1 = nLeftMargin + j * nSpace / 11;
355             y1 = nTopMargin + i * nHeight / 3;
356             x2 = x1 + nSpace / 11;
357             y2 = y1 + nHeight / 3;
358             rect1.SetRect(x1, y1, x2, y2);
359             m_buttons[2][i][j].Create(myButtons[2][i][j].sCaption, BS_FLAT | WS_CHILD | WS_TABSTOP | BS_PUSHBUTTON, rect1, this, myButtons[2][i][j].nID);
360             //            compare;
361         }
362     }
363     for (int i = 0; i < m_Lines; i++) {
364         for (int j = 0; j < 11; j++) {
365             x1 = nLeftMargin + j * nSpace / 11;
366             y1 = nTopMargin + i * nHeight / 3;
367             x2 = x1 + nSpace / 11;
368             y2 = y1 + nHeight / 3;
369             rect1.SetRect(x1, y1, x2, y2);
370             m_buttons[3][i][j].Create(myButtons[3][i][j].sCaption, BS_FLAT | WS_CHILD | WS_TABSTOP | BS_PUSHBUTTON, rect1, this, myButtons[3][i][j].nID);
371             //            word;
372         }
373     }
374     for (int i = 0; i < m_Lines; i++) {
375         for (int j = 0; j < 11; j++) {
376             x1 = nLeftMargin + j * nSpace / 11;
377             y1 = nTopMargin + i * nHeight / 3;
378             x2 = x1 + nSpace / 11;
379             y2 = y1 + nHeight / 3;
380             rect1.SetRect(x1, y1, x2, y2);
381             m_buttons[4][i][j].Create(myButtons[4][i][j].sCaption, BS_FLAT | WS_CHILD | WS_TABSTOP | BS_PUSHBUTTON, rect1, this, myButtons[4][i][j].nID);
382             //            index;
383         }
384     }
385     for (int i = 0; i < m_Lines; i++) {
386         for (int j = 0; j < 11; j++) {
387             x1 = nLeftMargin + j * nSpace / 11;
388             y1 = nTopMargin + i * nHeight / 3;
389             x2 = x1 + nSpace / 11;
390             y2 = y1 + nHeight / 3;
391             rect1.SetRect(x1, y1, x2, y2);
392             m_buttons[5][i][j].Create(myButtons[5][i][j].sCaption, BS_FLAT | WS_CHILD | WS_TABSTOP | BS_PUSHBUTTON, rect1, this, myButtons[5][i][j].nID);
393             //            TMCT;
394         }
395     }
396
397     return ;   
398
399 }
400
401
402 int CMyFormInputShow::OnMouseActivate(CWnd* pDesktopWnd, UINT nHitTest, UINT message)
403 {
404     // TODO: 在此添加消息处理程序代码和/或调用默认值
405
406     return CFormView::OnMouseActivate(pDesktopWnd, nHitTest, message);
407 }
408     
409
410 void CMyFormInputShow::OnTimer(UINT_PTR nIDEvent)
411 {
412     // TODO: 在此添加消息处理程序代码和/或调用默认值
413 /*
414     if (nIDEvent == 1)
415     {
416         KillTimer(1);
417         SetTimer(2, 200, NULL);
418     }
419     else if (nIDEvent == 2)
420     {
421         myLogger1.UpdateLogDisplay();
422     }
423     else
424     {
425
426     }
427 */
428     CFormView::OnTimer(nIDEvent);
429 }
430
431
432 void CMyFormInputShow::OnBnClickedButton1()
433 {
434     // TODO: 在此添加控件通知处理程序代码
435     CString s1;
436     s1.Format(_T("Button1 Clicked"));
437     SysLog(s1);
438 }
439
440
441
442
443 void CMyFormInputShow::SetBtnDisplayESC(int n)
444 {
445     for (int n = 1; n < 5; n++)
446     {
447         for (int i = 0; i < 3; i++) {
448             for (int j = 0; j < 11; j++) {
449                 m_buttons[n][i][j].ShowWindow(SW_HIDE);
450             }
451         }
452     }
453     for (int i = 0; i < 3; i++) {
454         for (int j = 0; j < 11; j++) {
455             m_buttons[0][i][j].ShowWindow(SW_SHOW);
456         }
457     }
458     current_btn_window = 0;
459 }
460
461 void CMyFormInputShow::SetBtnDisplay(int n)
462 {
463
464     for (int i = 0; i < 3; i++) {
465         for (int j = 0; j < 11; j++) {
466             m_buttons[current_btn_window][i][j].ShowWindow(SW_HIDE);
467         }
468     }
469
470     for (int i = 0; i < 3; i++) {
471         for (int j = 0; j < 11; j++) {
472             m_buttons[n][i][j].ShowWindow(SW_SHOW);
473         }
474     }
475     current_btn_window = n;
476 }
477
478
479 void CMyFormInputShow::stInit()
480 {
481     m_InputCell =
482     {
483          CMTerm1View::typeNO,
484          false,
485          false,
486          false,
487          false,
488          false,
489          false,
490          false,
491          false,
492          false,
493          false,
494          false,
495          false,
496          0x10,
497         _T("")
498     };
499 }
500
501
502 int CMyFormInputShow::display(tagInputCell stDisplayCell)
503 {
504     static CString strOp, strParam, strNum;
505     static CString str;
506     switch (stDisplayCell.OP)
507     {
508     case CMTerm1View::typeNO:
509         if ((m_InputCell.bLeftLineUp) && (m_InputCell.brightLineUp))
510         {
511             strOp = _T("└┤├┘");
512         }
513         else
514         {
515             strOp = _T("-| |-");
516         }
517
518         break;
519     case CMTerm1View::typeNC:
520         if ((m_InputCell.bLeftLineUp) && (m_InputCell.brightLineUp))
521         {
522             strOp = _T("└┤/├┘");
523         }
524         else
525         {
526             strOp = _T("-|/|-");
527         }
528
529         break;
530     case CMTerm1View::typeOUT:
531         strOp = _T("-[ ]");
532         break;
533     case CMTerm1View::typeSET:
534         strOp = _T("-<S>");
535         break;
536     case CMTerm1View::typeRESET:
537         strOp = _T("-<R>");
538         break;
539     case CMTerm1View::typeDF:
540         strOp = _T("(DF)");
541         break;
542     case CMTerm1View::typeDF_:
543         strOp = _T("(DF/)");
544         break;
545     case CMTerm1View::typeNOT:
546         strOp = _T("-/-");
547         break;
548     case CMTerm1View::typeTM:
549         strOp = _T("-[TM]");
550         break;
551     case CMTerm1View::typeCMP:
552         break;
553     default:
554         break;
555     }
556
557     if (stDisplayCell.bnot)
558     {
559         switch (stDisplayCell.OP)
560         {
561         case CMTerm1View::typeNO:
562             if ((m_InputCell.bLeftLineUp) && (m_InputCell.brightLineUp))
563             {
564                 strOp = _T("└┤/├┘");
565             }
566             else
567             {
568                 strOp = _T("-|/|-");
569             }
570             break;
571         case CMTerm1View::typeOUT:
572             strOp = _T("-/-");
573             break;
574         case CMTerm1View::typeSET:
575             strOp = _T("-/-");
576             break;
577         case CMTerm1View::typeRESET:
578             strOp = _T("-/-");
579             break;
580         case CMTerm1View::typeDF:
581             strOp = _T("(DF/)");
582             break;
583         case CMTerm1View::typeDF_:
584             strOp = _T("(DF)");
585             break;
586         case CMTerm1View::typeNOT:
587             strOp = _T("-/-");
588             break;
589         case CMTerm1View::typeTM:
590             strOp = _T("-/-");
591             break;
592         default:
593             break;
594         }
595     }
596     if (stDisplayCell.bpp)
597     {
598         switch (stDisplayCell.OP)
599         {
600         case CMTerm1View::typeNO:
601             if ((m_InputCell.bLeftLineUp) && (m_InputCell.brightLineUp))
602             {
603                 strOp = _T("└┤↑├┘");
604             }
605             else
606             {
607                 strOp = _T("-|↑|-");
608             }
609             break;
610         case CMTerm1View::typeOUT:
611             strOp = _T("-[↑]");
612             break;
613         default:
614             break;
615         }
616     }
617     if (stDisplayCell.bpn)
618     {
619         switch (stDisplayCell.OP)
620         {
621         case CMTerm1View::typeNO:
622             if ((m_InputCell.bLeftLineUp) && (m_InputCell.brightLineUp))
623             {
624                 strOp = _T("└┤↓├┘");
625             }
626             else
627             {
628                 strOp = _T("-|↓|-");
629             }
630             break;
631         case CMTerm1View::typeOUT:
632             strOp = _T("-[↓]");
633             break;
634         default:
635             break;
636         }
637     }
638
639     if (stDisplayCell.bDouble)
640     {
641         switch (stDisplayCell.OP)
642         {
643         case CMTerm1View::typeNO:
644             if ((m_InputCell.bLeftLineUp) && (m_InputCell.brightLineUp))
645             {
646                 strOp = _T("└┤├┘D");
647             }
648             else
649             {
650                 strOp = _T("-| |-D");
651             }
652             break;
653         case CMTerm1View::typeOUT:
654             strOp = _T("-| |-D");
655             break;
656         case CMTerm1View::typeSET:
657             strOp = _T("-| |-D");
658             break;
659         case CMTerm1View::typeRESET:
660             strOp = _T("-| |-D");
661             break;
662         case CMTerm1View::typeDF:
663             strOp = _T("-| |-D");
664             break;
665         case CMTerm1View::typeDF_:
666             strOp = _T("-| |-D");
667             break;
668         case CMTerm1View::typeNOT:
669             strOp = _T("-| |-D");
670             break;
671         case CMTerm1View::typeTM:
672             strOp = _T("-| |-D");
673             break;
674         default:
675             break;
676         }
677     }
678
679
680     if (stDisplayCell.bDouble1)
681     {
682         switch (stDisplayCell.OP)
683         {
684         case CMTerm1View::typeNO:
685             if ((m_InputCell.bLeftLineUp) && (m_InputCell.brightLineUp))
686             {
687                 strOp = _T("└┤├┘");
688             }
689             else
690             {
691                 strOp = _T("-| |-");
692             }
693             break;
694         case CMTerm1View::typeOUT:
695             strOp = _T("-| |-");
696             break;
697         case CMTerm1View::typeSET:
698             strOp = _T("-| |-");
699             break;
700         case CMTerm1View::typeRESET:
701             strOp = _T("-| |-");
702             break;
703         case CMTerm1View::typeDF:
704             strOp = _T("-| |-");
705             break;
706         case CMTerm1View::typeDF_:
707             strOp = _T("-| |-");
708             break;
709         case CMTerm1View::typeNOT:
710             strOp = _T("-| |-");
711             break;
712         case CMTerm1View::typeTM:
713             strOp = _T("-| |-");
714             break;
715         default:
716             break;
717         }
718     }
719
720     if (stDisplayCell.bFloat)
721     {
722         switch (stDisplayCell.OP)
723         {
724         case CMTerm1View::typeNO:
725             if ((m_InputCell.bLeftLineUp) && (m_InputCell.brightLineUp))
726             {
727                 strOp = _T("└┤├┘F");
728             }
729             else
730             {
731                 strOp = _T("-| |-F");
732             }
733             break;
734         case CMTerm1View::typeOUT:
735             strOp = _T("-| |-F");
736             break;
737         case CMTerm1View::typeSET:
738             strOp = _T("-| |-F");
739             break;
740         case CMTerm1View::typeRESET:
741             strOp = _T("-| |-F");
742             break;
743         case CMTerm1View::typeDF:
744             strOp = _T("-| |-F");
745             break;
746         case CMTerm1View::typeDF_:
747             strOp = _T("-| |-F");
748             break;
749         case CMTerm1View::typeNOT:
750             strOp = _T("-| |-F");
751             break;
752         case CMTerm1View::typeTM:
753             strOp = _T("-| |-F");
754             break;
755         default:
756             break;
757         }
758     }
759
760     if (stDisplayCell.bFloat1)
761     {
762         switch (stDisplayCell.OP)
763         {
764         case CMTerm1View::typeNO:
765             if ((m_InputCell.bLeftLineUp) && (m_InputCell.brightLineUp))
766             {
767                 strOp = _T("└┤├┘");
768             }
769             else
770             {
771                 strOp = _T("-| |-");
772             }
773         case CMTerm1View::typeOUT:
774             strOp = _T("-| |-");
775             break;
776         case CMTerm1View::typeSET:
777             strOp = _T("-| |-");
778             break;
779         case CMTerm1View::typeRESET:
780             strOp = _T("-| |-");
781             break;
782         case CMTerm1View::typeDF:
783             strOp = _T("-| |-");
784             break;
785         case CMTerm1View::typeDF_:
786             strOp = _T("-| |-");
787             break;
788         case CMTerm1View::typeNOT:
789             strOp = _T("-| |-");
790             break;
791         case CMTerm1View::typeTM:
792             strOp = _T("-| |-");
793             break;
794         default:
795             break;
796         }
797     }
798     switch (stDisplayCell.param)
799     {
800     case KLCoilTypeX:
801         strParam = _T("X");
802         break;
803     case KLCoilTypeY:
804         strParam = _T("Y");
805         break;
806     case KLCoilTypeR:
807         strParam = _T("R");
808         break;
809     case KLCoilTypeLR:
810         strParam = _T("L");
811         break;
812     case KLCoilTypeT:
813         strParam = _T("T");
814         break;
815     case KLCoilTypeC:
816         strParam = _T("C");
817         break;
818     case OP_TMX:
819         if (strOp == _T("-[TM]"))
820             strOp = "";
821         strParam = _T("-[TMX]");
822         break;
823     case OP_TMY:
824         if (strOp == _T("-[TM]"))
825             strOp = "";
826         strParam = _T("-[TMY]");
827         break;
828     case OP_TMR:
829         if (strOp == _T("-[TM]"))
830             strOp = "";
831         strParam = _T("-[TMR]");
832         break;
833     case OP_TML:
834         if (strOp == _T("-[TM]"))
835             strOp = "";
836         strParam = _T("-[TML]");
837         break;
838     default:
839         strParam = " ";
840         break;
841     }
842
843     if ((m_InputCell.bcmpEq) && (!m_InputCell.bcmpLt) && (!m_InputCell.bcmpGt))
844     {
845         strParam = "=";
846     }
847     if ((!m_InputCell.bcmpEq) && (m_InputCell.bcmpLt) && (!m_InputCell.bcmpGt))
848     {
849         strParam = "<";
850     }
851     if ((!m_InputCell.bcmpEq) && (!m_InputCell.bcmpLt) && (m_InputCell.bcmpGt))
852     {
853         strParam = ">";
854     }
855     if ((m_InputCell.bcmpEq) && (m_InputCell.bcmpLt))
856     {
857         strParam = "<=";
858     }
859     if ((m_InputCell.bcmpEq) && (m_InputCell.bcmpGt))
860     {
861         strParam = ">=";
862     }
863     if ((m_InputCell.bcmpLt) && (m_InputCell.bcmpGt))
864     {
865         strParam = "<>";
866     }
867     strNum = stDisplayCell.num;
868     str = strOp + _T(" ") + strParam + " " + strNum;
869     SetDlgItemText(IDC_EDIT_INPUT, str);
870     return 0;
871 }
872
873 int CMyFormInputShow::SetCurCellPos(int nRow, int nCol, CMTerm1View::stCell theCell)
874 {
875     m_InputCell.clear();
876
877     int nType = theCell.nType;
878     switch (nType)
879     {
880     case CMTerm1View::typeNone:
881         m_InputCell.OP = CMTerm1View::typeNO;
882
883         break;
884     case CMTerm1View::typeLine1:
885         m_InputCell.OP = nType;
886         break;
887     case CMTerm1View::typeLine2:
888         m_InputCell.OP = nType;
889         break;
890     case CMTerm1View::typeNO:
891         m_InputCell.OP = nType;
892         m_InputCell.sCellName = theCell.sCoilName;
893         m_InputCell.param= theCell.nDataType;
894         m_InputCell.num.Format(_T("%d"), theCell.nDataAddr);
895         break;
896     case CMTerm1View::typeNC:
897         m_InputCell.OP = nType;
898         break;
899     case CMTerm1View::typePP:
900         m_InputCell.OP = nType;
901
902         break;
903     case CMTerm1View::typePN:
904         m_InputCell.OP = nType;
905         break;
906     case CMTerm1View::typeNOT:
907         m_InputCell.OP = nType;
908         break;
909     case CMTerm1View::typeDF:
910         m_InputCell.OP = nType;
911         break;
912     case CMTerm1View::typeDF_:
913         m_InputCell.OP = nType;
914         break;
915     case CMTerm1View::typeOUT:
916         m_InputCell.OP = nType;
917         m_InputCell.sCellName = theCell.sCoilName;
918         m_InputCell.param = theCell.nDataType;
919         m_InputCell.num.Format(_T("%d"), theCell.nDataAddr);
920         break;
921     case CMTerm1View::typeSET:
922         m_InputCell.OP = nType;
923         m_InputCell.sCellName = theCell.sCoilName;
924         m_InputCell.param = theCell.nDataType;
925         m_InputCell.num.Format(_T("%d"), theCell.nDataAddr);
926         break;
927     case CMTerm1View::typeRESET:
928         m_InputCell.OP = nType;
929         m_InputCell.sCellName = theCell.sCoilName;
930         m_InputCell.param = theCell.nDataType;
931         m_InputCell.num.Format(_T("%d"), theCell.nDataAddr);
932         break;
933     case CMTerm1View::typeCMP:
934         m_InputCell.OP = nType;
935         break;
936     case CMTerm1View::typeExt1:
937         m_InputCell.sCellName = theCell.sParam;
938         m_InputCell.param = theCell.nDataType;
939         m_InputCell.num.Format(_T("%d"), theCell.nDataAddr);
940         m_InputCell.OP = nType;
941         break;
942     case CMTerm1View::typeExt2:
943         break;
944     case CMTerm1View::typeExt3:
945         break;
946     case CMTerm1View::typeTM:
947         m_InputCell.OP = CMTerm1View::typeTM;
948         break;
949     case CMTerm1View::typeFN1:
950         m_InputCell.OP = CMTerm1View::typeFN1;
951         break;
952     case CMTerm1View::typeFN2:
953         m_InputCell.OP = CMTerm1View::typeFN2;
954         break;
955     case CMTerm1View::typeFN3:
956         m_InputCell.OP = CMTerm1View::typeFN3;
957         break;
958     case CMTerm1View::typeCoil:
959         break;
960     default:
961         break;
962     }
963
964     display(m_InputCell);
965     return 0;
966 }
967
968
969 void CMyFormInputShow::OnBtnRet()
970 {
971     // TODO: 在此添加命令处理程序代码
972     CString strName;
973     CMTerm1View::stCell cell1;
974     CMainFrame* p1 = (CMainFrame*)AfxGetMainWnd();
975     CMDIChildWnd* pChild = (CMDIChildWnd*)p1->GetActiveFrame();
976     CView* p2 = (CView*)pChild->GetActiveView();
977     if (p2 == NULL) return;
978     CMTerm1View* p3 = (CMTerm1View*)p2;
979     //    m_wndDlgBar_InputShow.SetDisplay(0x00140000);
980     SetBtnDisplay(0);
981
982     switch (m_InputCell.OP)
983     {
984     case CMTerm1View::typeNO:
985     case CMTerm1View::typeNC:
986     case CMTerm1View::typeOUT:
987     case CMTerm1View::typeSET:
988     case CMTerm1View::typeRESET:
989     case CMTerm1View::typeTM:
990         switch (m_InputCell.param)
991         {
992         case KLCoilTypeX:
993             strName = "X";
994             break;
995         case KLCoilTypeY:
996             strName = "Y";
997             break;
998         case KLCoilTypeR:
999             strName = "R";
1000             break;
1001         case KLCoilTypeLR:
1002             strName = "L";
1003             break;
1004         case KLCoilTypeT:
1005             strName = "T";
1006             break;
1007         case KLCoilTypeC:
1008             strName = "C";
1009             break;
1010         case OP_TMX:
1011             strName = "TMX   ";
1012         case OP_TMY:
1013             strName = "TMY   ";
1014         case OP_TMR:
1015             strName = "TMR   ";
1016         case OP_TML:
1017             strName = "TML   ";
1018         default:
1019             break;
1020         }
1021     default:
1022         break;
1023     }
1024
1025
1026
1027     cell1.sCoilName = strName + m_InputCell.num;
1028     cell1.nType = m_InputCell.OP;
1029
1030     cell1.nProgStep = 0;
1031     cell1.bEditing = 1;
1032
1033     cell1.sParam = strName + m_InputCell.num;;
1034
1035     cell1.bLeftLineUp = 0;
1036     cell1.nDataType = CMTerm1View::typeCoil;
1037     cell1.nDataAddr = _tstoi(m_InputCell.num);
1038     cell1.bModified = 1;
1039     p3->SetCellToView(cell1);
1040
1041
1042     //    m_wndDlgBar_Func_Key.SetBtnDisplayESC();
1043 }
1044 void CMyFormInputShow::OnBtnInsert()
1045 {
1046     // TODO: 在此添加命令处理程序代码
1047     SetDisplay(0x00240000);
1048     //    m_wndDlgBar_Func_Key.SetBtnDisplayESC();
1049 }
1050 void CMyFormInputShow::OnBtnDelete()
1051 {
1052     // TODO: 在此添加命令处理程序代码
1053     SetDisplay(0x00340000);
1054     //    m_wndDlgBar_Func_Key.SetBtnDisplayESC();
1055 }
1056 void CMyFormInputShow::OnBtnEsc()
1057 {
1058     // TODO: 在此添加命令处理程序代码
1059     //m_wndDlgBar_InputShow.SetDisplay(_T("Esc"));
1060     SetBtnDisplayESC(0);
1061     //    m_wndDlgBar_Func_Key.SetBtnDisplayESC();
1062 }
1063
1064 static int flag = 0;
1065 int CMyFormInputShow::SetDisplay(int inputInfo)
1066 {
1067     /*stInputCell.OP = CMTerm1View::typeNO;
1068     stInputCell.param = KLCoilTypeY;
1069     stInputCell.num = _T("1234");*/
1070
1071     static int clickCounter = 0;
1072     static int clickCounterDF = 0;
1073     static int clickCounterNot = 0;
1074     static int clickCounterCMP = 0;
1075     static int clickCounterD = 0;
1076     static int clickCounterF = 0;
1077     static char curTaskState = 'A';
1078     static int lastLParam = 0;
1079     static int lastCMP = 0;
1080     static CString str, strStoreB, strStoreC, strNum;
1081     static CString strOp, strParam;
1082
1083
1084     CString s1, strNumTemp;
1085     int para = 0;
1086     int HParam, LParam;
1087 //    s1.Format(_T("is this window %d"), IsWindow(m_hWnd));
1088 //    SysLog(s1);
1089     //    ChangeState(inputInfo>>16, lastTaskState, curTaskState);
1090     if (inputInfo == 0x00010008)
1091     {
1092         clickCounterDF++;
1093         if (clickCounterDF == 1)                     //DF  redefine key value
1094         {
1095
1096             inputInfo = 0x00010008;
1097         }
1098         else if (clickCounterDF == 2)
1099         {
1100             inputInfo = 0x00010009;
1101             clickCounterDF = 0;
1102         }
1103     }
1104     if (inputInfo == 0x00010010)
1105     {
1106         clickCounter++;
1107
1108         if (clickCounter == 1)  //updown  redefine key value
1109         {
1110             inputInfo = 0x00010010;
1111         }
1112         else if (clickCounter == 2)
1113         {
1114             inputInfo = 0x00010011;
1115         }
1116         else if (clickCounter == 3)
1117         {
1118             inputInfo = 0x00010012;
1119             clickCounter = 0;
1120         }
1121     }
1122     if (inputInfo == 0x00010013)
1123     {
1124         clickCounterNot++;
1125         if (clickCounterNot == 1)                     //NOT  redefine key value
1126         {
1127
1128             inputInfo = 0x00010013;
1129         }
1130         else if (clickCounterNot == 2)
1131         {
1132             inputInfo = 0x00010014;
1133             clickCounterNot = 0;
1134         }
1135     }
1136
1137     if (inputInfo == 0x00010015)
1138     {
1139         clickCounterD++;
1140         if (clickCounterD == 1)                     //D  redefine key value
1141         {
1142
1143             inputInfo = 0x00010015;
1144         }
1145         else if (clickCounterD == 2)
1146         {
1147             inputInfo = 0x00010017;
1148             clickCounterD = 0;
1149         }
1150     }
1151
1152     if (inputInfo == 0x00010016)
1153     {
1154         clickCounterF++;
1155         if (clickCounterF == 1)                     //D  redefine key value
1156         {
1157
1158             inputInfo = 0x00010016;
1159         }
1160         else if (clickCounterF == 2)
1161         {
1162             inputInfo = 0x00010018;
1163             clickCounterF = 0;
1164         }
1165     }
1166
1167     HParam = inputInfo >> 16;
1168     LParam = inputInfo & 0xffff;
1169
1170
1171     switch (curTaskState)
1172     {
1173     case 'A':
1174         if (HParam == 0x1)                      //operator 1
1175         {
1176             m_InputCell.bnot = false;
1177             m_InputCell.bpp = false;
1178             m_InputCell.bpn = false;
1179             m_InputCell.bcmpEq = false;
1180             m_InputCell.bcmpLt = false;
1181             m_InputCell.bcmpGt = false;
1182             m_InputCell.bDouble = false;
1183             m_InputCell.bDouble1 = false;
1184             m_InputCell.bFloat = false;
1185             m_InputCell.bFloat1 = false;
1186             m_InputCell.bLeftLineUp = false;
1187             m_InputCell.brightLineUp = false;
1188
1189             if ((LParam >= 0x1) && (LParam <= 0x0f))
1190             {
1191
1192                 if ((LParam == 0x8) || (LParam == 0x9))         //IF DF  not clear df
1193                 {
1194                     clickCounter = 0;
1195                     clickCounterNot = 0;
1196                     clickCounterCMP = 0;
1197                     clickCounterD = 0;
1198                     clickCounterF = 0;
1199                 }
1200                 else
1201                 {
1202                     if (lastLParam != LParam)
1203                     {
1204                         clickCounter = 0;
1205                         clickCounterNot = 0;
1206                         clickCounterDF = 0;
1207                         clickCounterCMP = 0;
1208                         clickCounterD = 0;
1209                         clickCounterF = 0;
1210                     }
1211                 }
1212             }
1213             if ((lastLParam == 0x14) && ((LParam == 0x10) || (LParam == 0x11) || (LParam == 0x12)))  //from not to updown
1214             {
1215                 clickCounter = 1;
1216                 clickCounterNot = 0;
1217                 clickCounterDF = 0;
1218                 clickCounterCMP = 0;
1219                 clickCounterD = 0;
1220                 clickCounterF = 0;
1221
1222             }
1223             if ((lastLParam == 0x10) && ((LParam == 0x13) || (LParam == 0x14)))    //from up to not
1224             {
1225                 clickCounter = 0;
1226                 clickCounterNot = 1;
1227                 clickCounterDF = 0;
1228                 clickCounterCMP = 0;
1229                 clickCounterD = 0;
1230                 clickCounterF = 0;
1231
1232             }
1233             if ((lastLParam == 0x11) && ((LParam == 0x13) || (LParam == 0x14)))    //from down to not
1234             {
1235                 clickCounter = 0;
1236                 clickCounterNot = 1;
1237                 clickCounterDF = 0;
1238                 clickCounterCMP = 0;
1239                 clickCounterD = 0;
1240                 clickCounterF = 0;
1241             }
1242
1243             if ((lastLParam == 0x13) && ((LParam == 0x10) || (LParam == 0x11) || (LParam == 0x12)))  //not
1244             {
1245                 clickCounter = 0;
1246                 clickCounterNot = 0;
1247                 clickCounterDF = 0;
1248                 clickCounterCMP = 0;
1249                 clickCounterD = 0;
1250                 clickCounterF = 0;
1251
1252             }
1253             if ((lastLParam == 0x10) && ((LParam == 0x13) || (LParam == 0x14)))    //updown
1254             {
1255                 clickCounter = 0;
1256                 clickCounterNot = 0;
1257                 clickCounterDF = 0;
1258                 clickCounterCMP = 0;
1259                 clickCounterD = 0;
1260                 clickCounterF = 0;
1261
1262             }
1263             if ((lastLParam == 0x11) && ((LParam == 0x13) || (LParam == 0x14)))    //updown
1264             {
1265                 clickCounter = 0;
1266                 clickCounterNot = 0;
1267                 clickCounterDF = 0;
1268                 clickCounterCMP = 0;
1269                 clickCounterD = 0;
1270                 clickCounterF = 0;
1271             }
1272
1273             if ((lastLParam == 0x15) && ((LParam == 0x16) || (LParam == 0x18)))  //D ,"", F,""
1274             {
1275                 clickCounter = 0;
1276                 clickCounterNot = 0;
1277                 clickCounterDF = 0;
1278                 clickCounterCMP = 0;
1279                 clickCounterD = 0;
1280                 clickCounterF = 1;
1281             }
1282
1283             if ((lastLParam == 0x15) && ((LParam == 0x16) || (LParam == 0x18)))
1284             {
1285                 clickCounter = 0;
1286                 clickCounterNot = 0;
1287                 clickCounterDF = 0;
1288                 clickCounterCMP = 0;
1289                 clickCounterD = 0;
1290                 clickCounterF = 1;
1291             }
1292             if ((lastLParam == 0x17) && ((LParam == 0x16) || (LParam == 0x18)))
1293             {
1294                 clickCounter = 0;
1295                 clickCounterNot = 0;
1296                 clickCounterDF = 0;
1297                 clickCounterCMP = 0;
1298                 clickCounterD = 0;
1299                 clickCounterF = 1;
1300             }
1301             if ((lastLParam == 0x16) && ((LParam == 0x15) || (LParam == 0x17)))
1302             {
1303                 clickCounter = 0;
1304                 clickCounterNot = 0;
1305                 clickCounterDF = 0;
1306                 clickCounterCMP = 0;
1307                 clickCounterD = 1;
1308                 clickCounterF = 0;
1309             }
1310             if ((lastLParam == 0x18) && ((LParam == 0x15) || (LParam == 0x17)))
1311             {
1312                 clickCounter = 0;
1313                 clickCounterNot = 0;
1314                 clickCounterDF = 0;
1315                 clickCounterCMP = 0;
1316                 clickCounterD = 1;
1317                 clickCounterF = 0;
1318             }
1319             switch (LParam)
1320             {
1321             case 0x01:
1322                 m_InputCell.OP = CMTerm1View::typeNO; m_InputCell.param = 0x10;      //0x10 define para null 
1323
1324                 lastLParam = LParam;
1325                 curTaskState = 'B';
1326                 break;
1327             case 0x02:
1328                 m_InputCell.OP = CMTerm1View::typeNO; m_InputCell.param = 0x10;
1329                 m_InputCell.bLeftLineUp = true;
1330                 m_InputCell.brightLineUp = true;
1331                 lastLParam = LParam;
1332                 curTaskState = 'B';
1333                 break;
1334             case 0x03:
1335                 m_InputCell.OP = CMTerm1View::typeOUT; m_InputCell.param = 0x10;
1336
1337                 lastLParam = LParam;
1338                 curTaskState = 'B';
1339                 break;
1340                 /*case 4:
1341                     strOp = _T("(MC)");strParam = "";lastLParam = LParam;curTaskState = 'C'; break;
1342                 case 5:
1343                     strOp = _T("(MCE)");strParam = "";lastLParam = LParam;curTaskState = 'C'; break;*/
1344             case 0x06:
1345                 m_InputCell.OP = CMTerm1View::typeSET; m_InputCell.param = 0x10;
1346
1347                 lastLParam = LParam; curTaskState = 'B'; break;
1348             case 0x07:
1349                 m_InputCell.OP = CMTerm1View::typeRESET; m_InputCell.param = 0x10;
1350
1351                 lastLParam = LParam; curTaskState = 'B'; break;
1352             case 0x08:
1353                 m_InputCell.OP = CMTerm1View::typeDF; m_InputCell.param = 0x10;
1354
1355                 lastLParam = LParam;
1356                 curTaskState = 'A';
1357                 break;
1358             case 0x09:
1359                 m_InputCell.OP = CMTerm1View::typeDF_; m_InputCell.param = 0x10;
1360
1361                 lastLParam = LParam;
1362                 curTaskState = 'A';
1363                 break;
1364             case 0x0a:
1365                 strOp = _T("(ED)"); strParam = ""; lastLParam = LParam; curTaskState = 'A'; break;
1366             case 0x0b:
1367                 m_InputCell.OP = CMTerm1View::typeTM; m_InputCell.param = 0x10;
1368
1369                 lastLParam = LParam;
1370                 curTaskState = 'B';
1371                 break;
1372             case 0x10:
1373                 m_InputCell.bpp = true;
1374                 m_InputCell.bpn = false;
1375                 lastLParam = LParam;
1376                 break;
1377             case 0x11:
1378                 m_InputCell.bpp = false;
1379                 m_InputCell.bpn = true;
1380                 lastLParam = LParam;
1381                 break;
1382             case 0x12:
1383                 m_InputCell.bpp = false;
1384                 m_InputCell.bpn = false;
1385                 lastLParam = LParam;
1386                 break;
1387             case 0x13:
1388                 switch (lastLParam)
1389                 {
1390                 case 0x03:
1391                 case 0x06:
1392                 case 0x07:
1393                 case 0x15:
1394                 case 0x17:
1395                 case 0x16:
1396                 case 0x18:
1397                 case 0x20:
1398                 case 0x21:
1399                 case 0x22:
1400                     m_InputCell.OP = CMTerm1View::typeNOT;
1401                     clickCounterNot = 0;
1402                     curTaskState = 'A';
1403                 default:
1404                     break;
1405                 }
1406                 switch (lastLParam)
1407                 {
1408                 case 0x01:
1409                     m_InputCell.OP = CMTerm1View::typeNC; break;
1410                 case 0x02:
1411                     m_InputCell.OP = CMTerm1View::typeNC;
1412                     m_InputCell.bLeftLineUp = true;
1413                     m_InputCell.brightLineUp = true;
1414                     break;
1415                 default:
1416                     break;
1417                 }
1418                 lastLParam = LParam;
1419                 m_InputCell.bnot = true;
1420                 break;
1421             case 0x14:
1422                 m_InputCell.bnot = false;
1423                 break;
1424             case 0x15:
1425                 m_InputCell.bDouble = true;
1426                 m_InputCell.bDouble1 = false;
1427                 m_InputCell.bFloat = false;
1428                 m_InputCell.bFloat1 = false;
1429                 lastLParam = LParam; m_InputCell.param = 0x10; curTaskState = 'B';
1430                 break;
1431             case 0x17:
1432                 m_InputCell.bDouble = false;
1433                 m_InputCell.bDouble1 = true;
1434                 m_InputCell.bFloat = false;
1435                 m_InputCell.bFloat1 = false;
1436                 lastLParam = LParam; m_InputCell.param = 0x10; curTaskState = 'B';
1437                 break;
1438             case 0x16:
1439                 m_InputCell.bDouble = false;
1440                 m_InputCell.bDouble1 = false;
1441                 m_InputCell.bFloat = true;
1442                 m_InputCell.bFloat1 = false;
1443                 lastLParam = LParam; m_InputCell.param = 0x10; curTaskState = 'B';
1444                 break;
1445             case 0x18:
1446                 m_InputCell.bDouble = false;
1447                 m_InputCell.bDouble1 = false;
1448                 m_InputCell.bFloat = false;
1449                 m_InputCell.bFloat1 = true;
1450                 lastLParam = LParam; m_InputCell.param = 0x10; curTaskState = 'B';
1451                 break;
1452             default:
1453                 break;
1454             }
1455         }
1456
1457         str = strOp;
1458         break;
1459     case 'B':
1460         str = strOp;
1461         if (HParam == 0x1)                      //operator 1
1462         {
1463             m_InputCell.bnot = false;
1464             m_InputCell.bpp = false;
1465             m_InputCell.bpn = false;
1466             m_InputCell.bcmpEq = false;
1467             m_InputCell.bcmpLt = false;
1468             m_InputCell.bcmpGt = false;
1469             m_InputCell.bDouble = false;
1470             m_InputCell.bDouble1 = false;
1471             m_InputCell.bFloat = false;
1472             m_InputCell.bFloat1 = false;
1473             m_InputCell.bLeftLineUp = false;
1474             m_InputCell.brightLineUp = false;
1475             if ((LParam >= 0x0) && (LParam <= 0x0f))
1476             {
1477
1478                 if ((LParam == 0x08) || (LParam == 0x09))
1479                 {
1480                     clickCounter = 0;
1481                     clickCounterNot = 0;
1482                     clickCounterCMP = 0;
1483                     clickCounterD = 0;
1484                     clickCounterF = 0;
1485                 }
1486                 else
1487                 {
1488                     if (lastLParam != LParam)
1489                     {
1490                         clickCounter = 0;
1491                         clickCounterNot = 0;
1492                         clickCounterDF = 0;
1493                         clickCounterCMP = 0;
1494                         clickCounterD = 0;
1495                         clickCounterF = 0;
1496                     }
1497                 }
1498
1499             }
1500             if ((lastLParam == 0x13) && ((LParam == 0x10) || (LParam == 0x11) || (LParam == 0x12)))  //from not to updown
1501             {
1502                 clickCounter = 1;
1503                 clickCounterNot = 0;
1504                 clickCounterDF = 0;
1505                 clickCounterCMP = 0;
1506                 clickCounterD = 0;
1507                 clickCounterF = 0;
1508
1509             }
1510             if ((lastLParam == 0x14) && ((LParam == 0x10) || (LParam == 0x11) || (LParam == 0x12)))  //from not to updown
1511             {
1512                 clickCounter = 1;
1513                 clickCounterNot = 0;
1514                 clickCounterDF = 0;
1515                 clickCounterCMP = 0;
1516                 clickCounterD = 0;
1517                 clickCounterF = 0;
1518
1519             }
1520             if ((lastLParam == 0x10) && ((LParam == 0x13) || (LParam == 0x14)))    //from up to not
1521             {
1522                 clickCounter = 0;
1523                 clickCounterNot = 1;
1524                 clickCounterDF = 0;
1525                 clickCounterCMP = 0;
1526                 clickCounterD = 0;
1527                 clickCounterF = 0;
1528
1529             }
1530             if ((lastLParam == 0x11) && ((LParam == 0x13) || (LParam == 0x14)))    //from down to not
1531             {
1532                 clickCounter = 0;
1533                 clickCounterNot = 1;
1534                 clickCounterDF = 0;
1535                 clickCounterCMP = 0;
1536                 clickCounterD = 0;
1537                 clickCounterF = 0;
1538             }
1539             if ((lastLParam == 0x15) && ((LParam == 0x16) || (LParam == 0x18)))
1540             {
1541                 clickCounter = 0;
1542                 clickCounterNot = 0;
1543                 clickCounterDF = 0;
1544                 clickCounterCMP = 0;
1545                 clickCounterD = 0;
1546                 clickCounterF = 1;
1547             }
1548             if ((lastLParam == 0x17) && ((LParam == 0x16) || (LParam == 0x18)))
1549             {
1550                 clickCounter = 0;
1551                 clickCounterNot = 0;
1552                 clickCounterDF = 0;
1553                 clickCounterCMP = 0;
1554                 clickCounterD = 0;
1555                 clickCounterF = 1;
1556             }
1557             if ((lastLParam == 0x16) && ((LParam == 0x15) || (LParam == 0x17)))
1558             {
1559                 clickCounter = 0;
1560                 clickCounterNot = 0;
1561                 clickCounterDF = 0;
1562                 clickCounterCMP = 0;
1563                 clickCounterD = 1;
1564                 clickCounterF = 0;
1565             }
1566             if ((lastLParam == 0x18) && ((LParam == 0x15) || (LParam == 0x17)))
1567             {
1568                 clickCounter = 0;
1569                 clickCounterNot = 0;
1570                 clickCounterDF = 0;
1571                 clickCounterCMP = 0;
1572                 clickCounterD = 1;
1573                 clickCounterF = 0;
1574             }
1575             switch (LParam)
1576             {
1577             case 0x01:
1578                 m_InputCell.OP = CMTerm1View::typeNO; m_InputCell.param = 0x10;      //0x10 define para null 
1579
1580                 lastLParam = LParam;
1581                 curTaskState = 'B';
1582                 break;
1583             case 0x02:
1584                 m_InputCell.OP = CMTerm1View::typeNO; m_InputCell.param = 0x10;
1585                 m_InputCell.bLeftLineUp = true;
1586                 m_InputCell.brightLineUp = true;
1587                 lastLParam = LParam;
1588                 curTaskState = 'B';
1589                 break;
1590             case 0x03:
1591                 m_InputCell.OP = CMTerm1View::typeOUT; m_InputCell.param = 0x10;
1592
1593                 lastLParam = LParam;
1594                 curTaskState = 'B';
1595                 break;
1596                 /*case 4:
1597                     strOp = _T("(MC)");strParam = "";lastLParam = LParam;curTaskState = 'C'; break;
1598                 case 5:
1599                     strOp = _T("(MCE)");strParam = "";lastLParam = LParam;curTaskState = 'C'; break;*/
1600             case 0x06:
1601                 m_InputCell.OP = CMTerm1View::typeSET; m_InputCell.param = 0x10; ; lastLParam = LParam; curTaskState = 'B'; break;
1602             case 0x07:
1603                 m_InputCell.OP = CMTerm1View::typeRESET; m_InputCell.param = 0x10; ; lastLParam = LParam; curTaskState = 'B'; break;
1604             case 0x08:
1605                 m_InputCell.OP = CMTerm1View::typeDF;; m_InputCell.param = 0x10;
1606
1607                 lastLParam = LParam;
1608                 curTaskState = 'A';
1609                 break;
1610             case 0x9:
1611                 m_InputCell.OP = CMTerm1View::typeDF_; m_InputCell.param = 0x10;
1612
1613                 lastLParam = LParam;
1614                 curTaskState = 'A';
1615                 break;
1616             case 0x0a:
1617                 strOp = _T("(ED)"); strParam = ""; lastLParam = LParam; curTaskState = 'A'; break;
1618             case 0x0b:
1619                 m_InputCell.OP = CMTerm1View::typeTM; m_InputCell.param = 0x10;
1620
1621                 lastLParam = LParam;
1622                 curTaskState = 'B';
1623                 break;
1624             case 0x10:
1625                 m_InputCell.bpp = true;
1626                 m_InputCell.bpn = false;
1627                 lastLParam = LParam;
1628                 break;
1629             case 0x11:
1630                 m_InputCell.bpp = false;
1631                 m_InputCell.bpn = true;
1632                 lastLParam = LParam;
1633                 break;
1634             case 0x12:
1635                 m_InputCell.bpp = false;
1636                 m_InputCell.bpn = false;
1637                 lastLParam = LParam;
1638                 break;
1639             case 0x13:
1640                 switch (lastLParam)
1641                 {
1642                 case 0x03:
1643                 case 0x06:
1644                 case 0x07:
1645                 case 0x15:
1646                 case 0x17:
1647                 case 0x16:
1648                 case 0x18:
1649                 case 0x20:
1650                 case 0x21:
1651                 case 0x22:
1652                     m_InputCell.OP = CMTerm1View::typeNOT;
1653                     clickCounterNot = 0;
1654                     curTaskState = 'A';
1655                 default:
1656                     break;
1657                 }
1658
1659                 switch (lastLParam)
1660                 {
1661                 case 0x01:
1662                     m_InputCell.OP = CMTerm1View::typeNC; break;
1663                 case 0x02:
1664                     m_InputCell.OP = CMTerm1View::typeNC;
1665                     m_InputCell.bLeftLineUp = true;
1666                     m_InputCell.brightLineUp = true;
1667                     break;
1668                 default:
1669                     break;
1670                 }
1671
1672                 lastLParam = LParam;
1673                 m_InputCell.bnot = true;
1674                 break;
1675             case 0x14:
1676                 m_InputCell.bnot = false;
1677                 break;
1678             case 0x15:
1679                 m_InputCell.bDouble = true;
1680                 m_InputCell.bDouble1 = false;
1681                 m_InputCell.bFloat = false;
1682                 m_InputCell.bFloat1 = false;
1683                 m_InputCell.param = 0x10; lastLParam = LParam; curTaskState = 'B';
1684                 break;
1685             case 0x17:
1686                 m_InputCell.bDouble = false;
1687                 m_InputCell.bDouble1 = true;
1688                 m_InputCell.bFloat = false;
1689                 m_InputCell.bFloat1 = false;
1690                 m_InputCell.param = 0x10; lastLParam = LParam; curTaskState = 'B';
1691                 break;
1692             case 0x16:
1693                 m_InputCell.bDouble = false;
1694                 m_InputCell.bDouble1 = false;
1695                 m_InputCell.bFloat = true;
1696                 m_InputCell.bFloat1 = false;
1697                 lastLParam = LParam; m_InputCell.param = 0x10; curTaskState = 'B';
1698                 break;
1699             case 0x18:
1700                 m_InputCell.bDouble = false;
1701                 m_InputCell.bDouble1 = false;
1702                 m_InputCell.bFloat = false;
1703                 m_InputCell.bFloat1 = true;
1704                 lastLParam = LParam; m_InputCell.param = 0x10; curTaskState = 'B';
1705                 break;
1706             default:
1707                 break;
1708             }
1709         }
1710         else if (HParam == 0x2)
1711         {
1712             switch (LParam)
1713             {
1714             case 1:
1715                 m_InputCell.param = KLCoilTypeX; curTaskState = 'C'; break;
1716             case 2:
1717                 m_InputCell.param = KLCoilTypeY; curTaskState = 'C'; break;
1718             case 3:
1719                 m_InputCell.param = KLCoilTypeR; curTaskState = 'C'; break;
1720             case 4:
1721                 m_InputCell.param = KLCoilTypeLR; curTaskState = 'C'; break;
1722             case 5:
1723                 strParam = _T(" P"); curTaskState = 'C'; break;
1724             case 6:
1725                 m_InputCell.param = KLCoilTypeT; curTaskState = 'C'; break;
1726             case 7:
1727                 m_InputCell.param = KLCoilTypeC; curTaskState = 'C'; break;
1728             case 8:
1729                 strParam = _T(" E"); curTaskState = 'C'; break;
1730             case 9:
1731                 m_InputCell.param = OP_TMX; curTaskState = 'C'; break;
1732             case 0x0a:
1733                 m_InputCell.param = OP_TMY; curTaskState = 'C'; break;
1734             case 0x0b:
1735                 m_InputCell.param = OP_TMR; curTaskState = 'C'; break;
1736             case 0x0c:
1737                 m_InputCell.param = OP_TML; curTaskState = 'C'; break;
1738             case 0x0d:
1739                 if ((lastLParam == 0x03) || (lastLParam == 0x06) || (lastLParam == 0x07) || (lastLParam == 0x08) || (lastLParam == 0x09))
1740                 {
1741                     m_InputCell.OP = CMTerm1View::typeNO;
1742                     m_InputCell.bnot = false;
1743                     m_InputCell.bpp = false;
1744                     m_InputCell.bpn = false;
1745                     clickCounter = 0;
1746                     clickCounterNot = 0;
1747                     clickCounterDF = 0;
1748                     clickCounterD = 0;
1749                     clickCounterF = 0;
1750                 }
1751                 lastLParam = 0x20;
1752                 m_InputCell.bcmpEq = true;
1753                 if (lastCMP != LParam)
1754                 {
1755                     clickCounterCMP++;
1756                 }
1757                 else
1758                 {
1759                     clickCounterCMP = 1;
1760                     m_InputCell.bcmpGt = false;
1761                     m_InputCell.bcmpLt = false;
1762                 }
1763
1764                 if (clickCounterCMP > 2)
1765                 {
1766                     clickCounterCMP = 1;
1767                     m_InputCell.bcmpGt = false;
1768                     m_InputCell.bcmpLt = false;
1769                 }
1770                 lastCMP = LParam;
1771                 curTaskState = 'B'; break;
1772             case 0x0e:
1773                 if ((lastLParam == 0x03) || (lastLParam == 0x06) || (lastLParam == 0x07) || (lastLParam == 0x08) || (lastLParam == 0x09))
1774                 {
1775                     m_InputCell.OP = CMTerm1View::typeNO;
1776                     m_InputCell.bnot = false;
1777                     m_InputCell.bpp = false;
1778                     m_InputCell.bpn = false;
1779                     clickCounter = 0;
1780                     clickCounterNot = 0;
1781                     clickCounterDF = 0;
1782                     clickCounterD = 0;
1783                     clickCounterF = 0;
1784                 }
1785                 lastLParam = 0x21;
1786                 m_InputCell.bcmpGt = true;
1787                 if (lastCMP != LParam)
1788                 {
1789                     clickCounterCMP++;
1790                 }
1791                 else
1792                 {
1793                     clickCounterCMP = 1;
1794                     m_InputCell.bcmpEq = false;
1795                     m_InputCell.bcmpLt = false;
1796                 }
1797
1798                 if (clickCounterCMP > 2)
1799                 {
1800                     clickCounterCMP = 1;
1801                     m_InputCell.bcmpEq = false;
1802                     m_InputCell.bcmpLt = false;
1803                 }
1804                 lastCMP = LParam;
1805                 curTaskState = 'B'; break;
1806             case 0x0f:
1807                 if ((lastLParam == 0x03) || (lastLParam == 0x06) || (lastLParam == 0x07) || (lastLParam == 0x08) || (lastLParam == 0x09))
1808                 {
1809                     m_InputCell.OP = CMTerm1View::typeNO;
1810                     m_InputCell.bnot = false;
1811                     m_InputCell.bpp = false;
1812                     m_InputCell.bpn = false;
1813                     clickCounter = 0;
1814                     clickCounterNot = 0;
1815                     clickCounterDF = 0;
1816                     clickCounterD = 0;
1817                     clickCounterF = 0;
1818                 }
1819                 lastLParam = 0x22;                //  define op para; for translate to -/-
1820                 m_InputCell.bcmpLt = true;
1821                 if (lastCMP != LParam)
1822                 {
1823                     clickCounterCMP++;
1824                 }
1825                 else
1826                 {
1827                     clickCounterCMP = 1;
1828                     m_InputCell.bcmpEq = false;
1829                     m_InputCell.bcmpGt = false;
1830                 }
1831
1832                 if (clickCounterCMP > 2)
1833                 {
1834                     clickCounterCMP = 1;
1835                     m_InputCell.bcmpEq = false;
1836                     m_InputCell.bcmpGt = false;
1837                 }
1838                 lastCMP = LParam;             //record key num = > <
1839                 curTaskState = 'B'; break;
1840             default:
1841                 break;
1842             }
1843         }
1844
1845         break;
1846     case 'C':
1847         //    str = strOp + _T(" ") + strParam;
1848         if (HParam == 0x01)                      //operator 1
1849         {
1850             m_InputCell.bnot = false;
1851             m_InputCell.bpp = false;
1852             m_InputCell.bpn = false;
1853             m_InputCell.bcmpEq = false;
1854             m_InputCell.bcmpLt = false;
1855             m_InputCell.bcmpGt = false;
1856             m_InputCell.bDouble = false;
1857             m_InputCell.bFloat1 = false;
1858             m_InputCell.bFloat = false;
1859             m_InputCell.bFloat1 = false;
1860             m_InputCell.bLeftLineUp = false;
1861             m_InputCell.brightLineUp = false;
1862
1863             if ((LParam >= 0x01) && (LParam <= 0x0f))
1864             {
1865
1866                 if ((LParam == 0x08) || (LParam == 0x09))
1867                 {
1868                     clickCounter = 0;
1869                     clickCounterNot = 0;
1870                     clickCounterCMP = 0;
1871                     clickCounterD = 0;
1872                     clickCounterF = 0;
1873                 }
1874                 else
1875                 {
1876                     if (lastLParam != LParam)
1877                     {
1878                         clickCounter = 0;
1879                         clickCounterNot = 0;
1880                         clickCounterDF = 0;
1881                         clickCounterCMP = 0;
1882                         clickCounterD = 0;
1883                         clickCounterF = 0;
1884                     }
1885                 }
1886
1887             }
1888             if ((lastLParam == 0x14) && ((LParam == 0x10) || (LParam == 0x11) || (LParam == 0x12)))  //from not to updown
1889             {
1890                 clickCounter = 1;
1891                 clickCounterNot = 0;
1892                 clickCounterDF = 0;
1893                 clickCounterCMP = 0;
1894                 clickCounterD = 0;
1895                 clickCounterF = 0;
1896
1897             }
1898             if ((lastLParam == 0x10) && ((LParam == 0x13) || (LParam == 0x14)))    //from up to not
1899             {
1900                 clickCounter = 0;
1901                 clickCounterNot = 1;
1902                 clickCounterDF = 0;
1903                 clickCounterCMP = 0;
1904                 clickCounterD = 0;
1905                 clickCounterF = 0;
1906
1907             }
1908             if ((lastLParam == 0x11) && ((LParam == 0x13) || (LParam == 0x14)))    //from down to not
1909             {
1910                 clickCounter = 0;
1911                 clickCounterNot = 1;
1912                 clickCounterDF = 0;
1913                 clickCounterCMP = 0;
1914                 clickCounterD = 0;
1915                 clickCounterF = 0;
1916             }
1917             if ((lastLParam == 0x13) && ((LParam == 0x10) || (LParam == 0x11) || (LParam == 0x12)))  //not
1918             {
1919                 clickCounter = 0;
1920                 clickCounterNot = 0;
1921                 clickCounterDF = 0;
1922                 clickCounterCMP = 0;
1923                 clickCounterD = 0;
1924                 clickCounterF = 0;
1925
1926             }
1927             if ((lastLParam == 0x10) && ((LParam == 0x13) || (LParam == 0x14)))    //updown
1928             {
1929                 clickCounter = 0;
1930                 clickCounterNot = 0;
1931                 clickCounterDF = 0;
1932                 clickCounterCMP = 0;
1933                 clickCounterD = 0;
1934                 clickCounterF = 0;
1935
1936             }
1937             if ((lastLParam == 0x11) && ((LParam == 0x13) || (LParam == 0x14)))    //updown
1938             {
1939                 clickCounter = 0;
1940                 clickCounterNot = 0;
1941                 clickCounterDF = 0;
1942                 clickCounterCMP = 0;
1943                 clickCounterD = 0;
1944                 clickCounterF = 0;
1945             }
1946             if ((lastLParam == 0x15) && ((LParam == 0x16) || (LParam == 0x18)))
1947             {
1948                 clickCounter = 0;
1949                 clickCounterNot = 0;
1950                 clickCounterDF = 0;
1951                 clickCounterCMP = 0;
1952                 clickCounterD = 0;
1953                 clickCounterF = 1;
1954             }
1955             if ((lastLParam == 0x17) && ((LParam == 0x16) || (LParam == 0x18)))
1956             {
1957                 clickCounter = 0;
1958                 clickCounterNot = 0;
1959                 clickCounterDF = 0;
1960                 clickCounterCMP = 0;
1961                 clickCounterD = 0;
1962                 clickCounterF = 1;
1963             }
1964             if ((lastLParam == 0x16) && ((LParam == 0x15) || (LParam == 0x17)))
1965             {
1966                 clickCounter = 0;
1967                 clickCounterNot = 0;
1968                 clickCounterDF = 0;
1969                 clickCounterCMP = 0;
1970                 clickCounterD = 1;
1971                 clickCounterF = 0;
1972             }
1973             if ((lastLParam == 0x18) && ((LParam == 0x15) || (LParam == 0x17)))
1974             {
1975                 clickCounter = 0;
1976                 clickCounterNot = 0;
1977                 clickCounterDF = 0;
1978                 clickCounterCMP = 0;
1979                 clickCounterD = 1;
1980                 clickCounterF = 0;
1981             }
1982             switch (LParam)
1983             {
1984             case 0x01:
1985                 m_InputCell.OP = CMTerm1View::typeNO; m_InputCell.param = 0x10;      //0x10 define para null 
1986
1987                 lastLParam = LParam;
1988                 curTaskState = 'B';
1989                 break;
1990             case 0x02:
1991                 m_InputCell.OP = CMTerm1View::typeNO; m_InputCell.param = 0x10;
1992                 m_InputCell.bLeftLineUp = true;
1993                 m_InputCell.brightLineUp = true;
1994                 lastLParam = LParam;
1995                 curTaskState = 'B';
1996                 break;
1997             case 0x03:
1998                 m_InputCell.OP = CMTerm1View::typeOUT; m_InputCell.param = 0x10;
1999                 lastLParam = LParam;
2000                 curTaskState = 'B';
2001                 break;
2002                 /*case 4:
2003                     strOp = _T("(MC)");strParam = "";lastLParam = LParam;curTaskState = 'C'; break;
2004                 case 5:
2005                     strOp = _T("(MCE)");strParam = "";lastLParam = LParam;curTaskState = 'C'; break;*/
2006             case 0x06:
2007                 m_InputCell.OP = CMTerm1View::typeSET; m_InputCell.param = 0x10; ; lastLParam = LParam; curTaskState = 'B'; break;
2008             case 0x07:
2009                 m_InputCell.OP = CMTerm1View::typeRESET; m_InputCell.param = 0x10; ; lastLParam = LParam; curTaskState = 'B'; break;
2010             case 0x08:
2011                 m_InputCell.OP = CMTerm1View::typeDF;; m_InputCell.param = 0x10;
2012                 lastLParam = LParam;
2013                 curTaskState = 'A';
2014                 break;
2015             case 0x09:
2016                 m_InputCell.OP = CMTerm1View::typeDF_; m_InputCell.param = 0x10;
2017
2018                 lastLParam = LParam;
2019                 curTaskState = 'A';
2020                 break;
2021             case 0x0a:
2022                 strOp = _T("(ED)"); strParam = ""; lastLParam = LParam; curTaskState = 'A'; break;
2023             case 0x0b:
2024                 m_InputCell.OP = CMTerm1View::typeTM; m_InputCell.param = 0x10;
2025
2026                 lastLParam = LParam;
2027                 curTaskState = 'B';
2028                 break;
2029             case 0x10:
2030                 m_InputCell.bpp = true;
2031                 m_InputCell.bpn = false;
2032                 break;
2033             case 0x11:
2034                 m_InputCell.bpp = false;
2035                 m_InputCell.bpn = true;
2036                 break;
2037             case 0x12:
2038                 m_InputCell.bpp = false;
2039                 m_InputCell.bpn = false;
2040                 break;
2041             case 0x13:
2042                 switch (lastLParam)
2043                 {
2044                 case 0x03:
2045                 case 0x06:
2046                 case 0x07:
2047                 case 0x15:
2048                 case 0x17:
2049                 case 0x16:
2050                 case 0x18:
2051                 case 0x20:
2052                 case 0x21:
2053                 case 0x22:
2054                     m_InputCell.OP = CMTerm1View::typeNOT;
2055                     clickCounterNot = 0;
2056
2057                     curTaskState = 'A';
2058                 default:
2059                     break;
2060                 }
2061                 switch (lastLParam)
2062                 {
2063                 case 0x01:
2064                     m_InputCell.OP = CMTerm1View::typeNC; break;
2065                 case 0x02:
2066                     m_InputCell.OP = CMTerm1View::typeNC;
2067                     m_InputCell.bLeftLineUp = true;
2068                     m_InputCell.brightLineUp = true;
2069                     break;
2070                 default:
2071                     break;
2072                 }
2073                 lastLParam = LParam;
2074                 m_InputCell.bnot = true;
2075
2076                 break;
2077             case 0x14:
2078                 m_InputCell.bnot = false;
2079                 break;
2080             case 0x15:
2081                 m_InputCell.bDouble = true;
2082                 m_InputCell.bDouble1 = false;
2083                 m_InputCell.bFloat = false;
2084                 m_InputCell.bFloat1 = false;
2085                 m_InputCell.param = 0x10; lastLParam = LParam; curTaskState = 'B';
2086                 break;
2087             case 0x17:
2088                 m_InputCell.bDouble = false;
2089                 m_InputCell.bDouble1 = true;
2090                 m_InputCell.bFloat = false;
2091                 m_InputCell.bFloat1 = false;
2092                 m_InputCell.param = 0x10; lastLParam = LParam; curTaskState = 'B';
2093                 break;
2094             case 0x16:
2095                 m_InputCell.bDouble = false;
2096                 m_InputCell.bDouble1 = false;
2097                 m_InputCell.bFloat = true;
2098                 m_InputCell.bFloat1 = false;
2099                 lastLParam = LParam; m_InputCell.param = 0x10; curTaskState = 'B';
2100                 break;
2101             case 0x18:
2102                 m_InputCell.bDouble = false;
2103                 m_InputCell.bDouble1 = false;
2104                 m_InputCell.bFloat = false;
2105                 m_InputCell.bFloat1 = true;
2106                 lastLParam = LParam; m_InputCell.param = 0x10; curTaskState = 'B';
2107                 break;
2108             default:
2109                 break;
2110             }
2111         }
2112         else if (HParam == 0x2)
2113         {
2114             switch (LParam)
2115             {
2116             case 1:
2117                 m_InputCell.param = KLCoilTypeX; curTaskState = 'C'; break;
2118             case 2:
2119                 m_InputCell.param = KLCoilTypeY; curTaskState = 'C'; break;
2120             case 3:
2121                 m_InputCell.param = KLCoilTypeR; curTaskState = 'C'; break;
2122             case 4:
2123                 m_InputCell.param = KLCoilTypeLR; curTaskState = 'C'; break;
2124             case 5:
2125                 strParam = _T(" P"); curTaskState = 'C'; break;
2126             case 6:
2127                 m_InputCell.param = KLCoilTypeT; curTaskState = 'C'; break;
2128             case 7:
2129                 m_InputCell.param = KLCoilTypeC; curTaskState = 'C'; break;
2130             case 8:
2131                 strParam = _T(" E"); curTaskState = 'C'; break;
2132             case 9:
2133                 m_InputCell.param = OP_TMX; curTaskState = 'C'; break;
2134             case 0x0a:
2135                 m_InputCell.param = OP_TMY; curTaskState = 'C'; break;
2136             case 0x0b:
2137                 m_InputCell.param = OP_TMR; curTaskState = 'C'; break;
2138             case 0x0c:
2139                 m_InputCell.param = OP_TML; curTaskState = 'C'; break;
2140             case 0x0d:
2141                 if ((lastLParam == 0x03) || (lastLParam == 0x06) || (lastLParam == 0x07) || (lastLParam == 0x08) || (lastLParam == 0x09))
2142                 {
2143                     m_InputCell.OP = CMTerm1View::typeNO;
2144                     m_InputCell.bnot = false;
2145                     m_InputCell.bpp = false;
2146                     m_InputCell.bpn = false;
2147                     clickCounter = 0;
2148                     clickCounterNot = 0;
2149                     clickCounterDF = 0;
2150                     clickCounterD = 0;
2151                     clickCounterF = 0;
2152                 }
2153                 lastLParam = 0x20;
2154                 m_InputCell.bcmpEq = true;
2155                 if (lastCMP != LParam)
2156                 {
2157                     clickCounterCMP++;
2158                 }
2159                 else
2160                 {
2161                     clickCounterCMP = 1;
2162                     m_InputCell.bcmpGt = false;
2163                     m_InputCell.bcmpLt = false;
2164                 }
2165                 if (clickCounterCMP > 2)
2166                 {
2167                     clickCounterCMP = 1;
2168                     m_InputCell.bcmpGt = false;
2169                     m_InputCell.bcmpLt = false;
2170                 }
2171                 lastCMP = LParam;
2172                 curTaskState = 'B'; break;
2173             case 0x0e:
2174                 if ((lastLParam == 0x03) || (lastLParam == 0x06) || (lastLParam == 0x07) || (lastLParam == 0x08) || (lastLParam == 0x09))
2175                 {
2176                     m_InputCell.OP = CMTerm1View::typeNO;
2177                     m_InputCell.bnot = false;
2178                     m_InputCell.bpp = false;
2179                     m_InputCell.bpn = false;
2180                     clickCounter = 0;
2181                     clickCounterNot = 0;
2182                     clickCounterDF = 0;
2183                     clickCounterD = 0;
2184                     clickCounterF = 0;
2185                 }
2186                 lastLParam = 0x21;
2187                 m_InputCell.bcmpGt = true;
2188                 if (lastCMP != LParam)
2189                 {
2190                     clickCounterCMP = 1;
2191                     clickCounterCMP++;
2192                 }
2193                 else
2194                 {
2195                     m_InputCell.bcmpEq = false;
2196                     m_InputCell.bcmpLt = false;
2197                 }
2198                 if (clickCounterCMP > 2)
2199                 {
2200                     clickCounterCMP = 1;
2201                     m_InputCell.bcmpEq = false;
2202                     m_InputCell.bcmpLt = false;
2203                 }
2204                 lastCMP = LParam;
2205                 curTaskState = 'B'; break;
2206             case 0x0f:
2207                 if ((lastLParam == 0x03) || (lastLParam == 0x06) || (lastLParam == 0x07) || (lastLParam == 0x08) || (lastLParam == 0x09))
2208                 {
2209                     m_InputCell.OP = CMTerm1View::typeNO;
2210                     m_InputCell.bnot = false;
2211                     m_InputCell.bpp = false;
2212                     m_InputCell.bpn = false;
2213                     clickCounter = 0;
2214                     clickCounterNot = 0;
2215                     clickCounterDF = 0;
2216                     clickCounterD = 0;
2217                     clickCounterF = 0;
2218                 }
2219                 lastLParam = 0x22;
2220                 m_InputCell.bcmpLt = true;
2221                 if (lastCMP != LParam)
2222                 {
2223                     clickCounterCMP++;
2224                 }
2225                 else
2226                 {
2227                     clickCounterCMP = 1;
2228                     m_InputCell.bcmpEq = false;
2229                     m_InputCell.bcmpGt = false;
2230                 }
2231                 if (clickCounterCMP > 2)
2232                 {
2233                     clickCounterCMP = 1;
2234                     m_InputCell.bcmpEq = false;
2235                     m_InputCell.bcmpGt = false;
2236                 }
2237                 lastCMP = LParam;
2238                 curTaskState = 'B'; break;
2239             default:
2240                 break;
2241             }
2242         }
2243         else if (HParam == 0x3)
2244         {
2245             switch (LParam)
2246             {
2247             case 0:
2248                 strNumTemp = _T("0"); curTaskState = 'D'; break;
2249             case 1:
2250                 strNumTemp = _T("1"); curTaskState = 'D'; break;
2251             case 2:
2252                 strNumTemp = _T("2"); curTaskState = 'D'; break;
2253             case 3:
2254                 strNumTemp = _T("3"); curTaskState = 'D'; break;
2255             case 4:
2256                 strNumTemp = _T("4"); curTaskState = 'D'; break;
2257             case 5:
2258                 strNumTemp = _T("5"); curTaskState = 'D'; break;
2259             case 6:
2260                 strNumTemp = _T("6"); curTaskState = 'D'; break;
2261             case 7:
2262                 strNumTemp = _T("7"); curTaskState = 'D'; break;
2263             case 8:
2264                 strNumTemp = _T("8"); curTaskState = 'D'; break;
2265             case 9:
2266                 strNumTemp = _T("9"); curTaskState = 'D'; break;
2267             case 0x0A:
2268                 if ((m_InputCell.param == KLCoilTypeT) || (m_InputCell.param == KLCoilTypeC))
2269                     ;                        //state not change
2270                 else
2271                 {
2272                     strNumTemp = _T("A"); curTaskState = 'D';
2273                 }
2274                 break;
2275             case 0x0B:
2276                 if ((m_InputCell.param == KLCoilTypeT) || (m_InputCell.param == KLCoilTypeC))
2277                     ;
2278                 else
2279                 {
2280                     strNumTemp = _T("B"); curTaskState = 'D';
2281                 }
2282                 break;
2283             case 0x0C:
2284                 if ((m_InputCell.param == KLCoilTypeT) || (m_InputCell.param == KLCoilTypeC))
2285                     ;
2286                 else
2287                 {
2288                     strNumTemp = _T("C"); curTaskState = 'D';
2289                 }
2290                 break;
2291             case 0x0D:
2292                 if ((m_InputCell.param == KLCoilTypeT) || (m_InputCell.param == KLCoilTypeC))
2293                     ;
2294                 else
2295                 {
2296                     strNumTemp = _T("D"); curTaskState = 'D';
2297                 }
2298                 break;
2299
2300             case 0x0E:
2301                 if ((m_InputCell.param == KLCoilTypeT) || (m_InputCell.param == KLCoilTypeC))
2302                     ;
2303                 else
2304                 {
2305                     strNumTemp = _T("E"); curTaskState = 'D';
2306                 }
2307                 break;
2308             case 0x0F:
2309                 if ((m_InputCell.param == KLCoilTypeT) || (m_InputCell.param == KLCoilTypeC))
2310                     ;
2311                 else
2312                 {
2313                     strNumTemp = _T("F"); curTaskState = 'D';
2314                 }
2315                 break;
2316             default:
2317                 break;
2318             }
2319
2320             if (m_InputCell.num.GetLength() < 4)
2321             {
2322                 m_InputCell.num.Append(strNumTemp);
2323             }
2324             else
2325             {
2326                 m_InputCell.num = m_InputCell.num.Right(m_InputCell.num.GetLength() - 1);
2327                 m_InputCell.num.Append(strNumTemp);
2328             }
2329         }
2330
2331         break;
2332     case 'D':
2333         if (HParam == 0x1)                      //operator 1
2334         {
2335             m_InputCell.bnot = false;
2336             m_InputCell.bpp = false;
2337             m_InputCell.bpn = false;
2338             m_InputCell.bcmpEq = false;
2339             m_InputCell.bcmpLt = false;
2340             m_InputCell.bcmpGt = false;
2341             m_InputCell.bDouble = false;
2342             m_InputCell.bDouble1 = false;
2343             m_InputCell.bFloat = false;
2344             m_InputCell.bFloat1 = false;
2345             m_InputCell.bLeftLineUp = false;
2346             m_InputCell.brightLineUp = false;
2347
2348
2349             if ((LParam >= 0x01) && (LParam <= 0x0f))
2350             {
2351
2352                 m_InputCell.num.Empty();
2353                 if ((LParam == 0x08) || (LParam == 0x09))
2354                 {
2355                     clickCounter = 0;
2356                     clickCounterNot = 0;
2357                     clickCounterCMP = 0;
2358                     clickCounterD = 0;
2359                     clickCounterF = 0;
2360                 }
2361                 else
2362                 {
2363                     if (lastLParam != LParam)
2364                     {
2365                         clickCounter = 0;
2366                         clickCounterNot = 0;
2367                         clickCounterDF = 0;
2368                         clickCounterCMP = 0;
2369                         clickCounterD = 0;
2370                         clickCounterF = 0;
2371                     }
2372                 }
2373             }
2374             if ((lastLParam == 0x14) && ((LParam == 0x10) || (LParam == 0x11) || (LParam == 0x12)))  //from not to updown
2375             {
2376                 clickCounter = 1;
2377                 clickCounterNot = 0;
2378                 clickCounterDF = 0;
2379                 clickCounterCMP = 0;
2380                 clickCounterD = 0;
2381                 clickCounterF = 0;
2382
2383             }
2384             if ((lastLParam == 0x10) && ((LParam == 0x13) || (LParam == 0x14)))    //from up to not
2385             {
2386                 clickCounter = 0;
2387                 clickCounterNot = 1;
2388                 clickCounterDF = 0;
2389                 clickCounterCMP = 0;
2390                 clickCounterD = 0;
2391                 clickCounterF = 0;
2392
2393             }
2394             if ((lastLParam == 0x11) && ((LParam == 0x13) || (LParam == 0x14)))    //from down to not
2395             {
2396                 clickCounter = 0;
2397                 clickCounterNot = 1;
2398                 clickCounterDF = 0;
2399                 clickCounterCMP = 0;
2400                 clickCounterD = 0;
2401                 clickCounterF = 0;
2402             }
2403
2404             if ((lastLParam == 0x13) && ((LParam == 0x10) || (LParam == 0x11) || (LParam == 0x12)))  //not
2405             {
2406                 clickCounter = 0;
2407                 clickCounterNot = 0;
2408                 clickCounterDF = 0;
2409                 clickCounterCMP = 0;
2410                 clickCounterD = 0;
2411                 clickCounterF = 0;
2412
2413             }
2414             if ((lastLParam == 0x10) && ((LParam == 0x13) || (LParam == 0x14)))    //updown
2415             {
2416                 clickCounter = 0;
2417                 clickCounterNot = 0;
2418                 clickCounterDF = 0;
2419                 clickCounterCMP = 0;
2420                 clickCounterD = 0;
2421                 clickCounterF = 0;
2422
2423             }
2424             if ((lastLParam == 0x11) && ((LParam == 0x13) || (LParam == 0x14)))    //updown
2425             {
2426                 clickCounter = 0;
2427                 clickCounterNot = 0;
2428                 clickCounterDF = 0;
2429                 clickCounterCMP = 0;
2430                 clickCounterD = 0;
2431                 clickCounterF = 0;
2432             }
2433             if ((lastLParam == 0x15) && ((LParam == 0x16) || (LParam == 0x18)))
2434             {
2435                 clickCounter = 0;
2436                 clickCounterNot = 0;
2437                 clickCounterDF = 0;
2438                 clickCounterCMP = 0;
2439                 clickCounterD = 0;
2440                 clickCounterF = 1;
2441             }
2442             if ((lastLParam == 0x17) && ((LParam == 0x16) || (LParam == 0x18)))
2443             {
2444                 clickCounter = 0;
2445                 clickCounterNot = 0;
2446                 clickCounterDF = 0;
2447                 clickCounterCMP = 0;
2448                 clickCounterD = 0;
2449                 clickCounterF = 1;
2450             }
2451             if ((lastLParam == 0x16) && ((LParam == 0x15) || (LParam == 0x17)))
2452             {
2453                 clickCounter = 0;
2454                 clickCounterNot = 0;
2455                 clickCounterDF = 0;
2456                 clickCounterCMP = 0;
2457                 clickCounterD = 1;
2458                 clickCounterF = 0;
2459             }
2460             if ((lastLParam == 0x18) && ((LParam == 0x15) || (LParam == 0x17)))
2461             {
2462                 clickCounter = 0;
2463                 clickCounterNot = 0;
2464                 clickCounterDF = 0;
2465                 clickCounterCMP = 0;
2466                 clickCounterD = 1;
2467                 clickCounterF = 0;
2468             }
2469             switch (LParam)
2470             {
2471             case 0x01:
2472                 m_InputCell.OP = CMTerm1View::typeNO; m_InputCell.param = 0x10;      //0x10 define para null 
2473
2474                 lastLParam = LParam;
2475                 curTaskState = 'B';
2476                 break;
2477             case 0x02:
2478                 m_InputCell.OP = CMTerm1View::typeNO; m_InputCell.param = 0x10;
2479                 m_InputCell.bLeftLineUp = true;
2480                 m_InputCell.brightLineUp = true;
2481                 lastLParam = LParam;
2482                 curTaskState = 'B';
2483                 break;
2484             case 0x03:
2485                 m_InputCell.OP = CMTerm1View::typeOUT; m_InputCell.param = 0x10;
2486
2487                 lastLParam = LParam;
2488                 curTaskState = 'B';
2489                 break;
2490                 /*case 4:
2491                     strOp = _T("(MC)");strParam = "";lastLParam = LParam;curTaskState = 'C'; break;
2492                 case 5:
2493                     strOp = _T("(MCE)");strParam = "";lastLParam = LParam;curTaskState = 'C'; break;*/
2494             case 0x06:
2495                 m_InputCell.OP = CMTerm1View::typeSET; m_InputCell.param = 0x10; ; lastLParam = LParam; curTaskState = 'B'; break;
2496             case 0x07:
2497                 m_InputCell.OP = CMTerm1View::typeRESET; m_InputCell.param = 0x10; ; lastLParam = LParam; curTaskState = 'B'; break;
2498             case 0x08:
2499                 m_InputCell.OP = CMTerm1View::typeDF; m_InputCell.param = 0x10;
2500
2501                 lastLParam = LParam;
2502                 curTaskState = 'A';
2503                 break;
2504             case 0x09:
2505                 m_InputCell.OP = CMTerm1View::typeDF_; m_InputCell.param = 0x10;
2506
2507                 lastLParam = LParam;
2508                 curTaskState = 'A';
2509                 break;
2510             case 0x0a:
2511                 strOp = _T("(ED)"); strParam = ""; lastLParam = LParam; curTaskState = 'A'; break;
2512             case 0x0b:
2513                 m_InputCell.OP = CMTerm1View::typeTM; m_InputCell.param = 0x10;
2514
2515                 lastLParam = LParam;
2516                 curTaskState = 'B';
2517                 break;
2518             case 0x10:
2519                 m_InputCell.bpp = true;
2520                 m_InputCell.bpn = false;
2521                 break;
2522             case 0x11:
2523                 m_InputCell.bpp = false;
2524                 m_InputCell.bpn = true;
2525                 break;
2526             case 0x12:
2527                 m_InputCell.bpp = false;
2528                 m_InputCell.bpn = false;
2529                 break;
2530             case 0x13:
2531                 switch (lastLParam)
2532                 {
2533                 case 3:
2534                 case 6:
2535                 case 7:
2536                 case 0x15:
2537                 case 0x17:
2538                 case 0x16:
2539                 case 0x18:
2540                 case 0x20:
2541                 case 0x21:
2542                 case 0x22:
2543                     m_InputCell.OP = CMTerm1View::typeNOT;
2544                     clickCounterNot = 0;
2545                     curTaskState = 'A';
2546                 default:
2547                     break;
2548                 }
2549                 switch (lastLParam)
2550                 {
2551                 case 0x01:
2552                     m_InputCell.OP = CMTerm1View::typeNC; break;
2553                 case 0x02:
2554                     m_InputCell.OP = CMTerm1View::typeNC;
2555                     m_InputCell.bLeftLineUp = true;
2556                     m_InputCell.brightLineUp = true;
2557                     break;
2558                 default:
2559                     break;
2560                 }
2561                 lastLParam = LParam;
2562                 m_InputCell.bnot = true;
2563
2564                 break;
2565             case 0x14:
2566                 m_InputCell.bnot = false;
2567                 break;
2568             case 0x15:
2569                 m_InputCell.bDouble = true;
2570                 m_InputCell.bDouble1 = false;
2571                 m_InputCell.bFloat = false;
2572                 m_InputCell.bFloat1 = false;
2573                 m_InputCell.param = 0x10; lastLParam = LParam; curTaskState = 'B';
2574                 break;
2575             case 0x17:
2576                 m_InputCell.bDouble = false;
2577                 m_InputCell.bDouble1 = true;
2578                 m_InputCell.bFloat = false;
2579                 m_InputCell.bFloat1 = false;
2580                 m_InputCell.param = 0x10; lastLParam = LParam; curTaskState = 'B';
2581                 break;
2582             case 0x16:
2583                 m_InputCell.bDouble = false;
2584                 m_InputCell.bDouble1 = false;
2585                 m_InputCell.bFloat = true;
2586                 m_InputCell.bFloat1 = false;
2587                 lastLParam = LParam; m_InputCell.param = 0x10; curTaskState = 'B';
2588                 break;
2589             case 0x18:
2590                 m_InputCell.bDouble = false;
2591                 m_InputCell.bDouble1 = false;
2592                 m_InputCell.bFloat = false;
2593                 m_InputCell.bFloat1 = true;
2594                 lastLParam = LParam; m_InputCell.param = 0x10; curTaskState = 'B';
2595                 break;
2596             default:
2597                 break;
2598             }
2599             if (curTaskState != 'D')
2600             {
2601                 m_InputCell.num.Empty();
2602             }
2603         }
2604         else if (HParam == 0x2)
2605         {
2606             switch (LParam)
2607             {
2608             case 1:
2609                 m_InputCell.param = KLCoilTypeX; curTaskState = 'C'; break;
2610             case 2:
2611                 m_InputCell.param = KLCoilTypeY; curTaskState = 'C'; break;
2612             case 3:
2613                 m_InputCell.param = KLCoilTypeR; curTaskState = 'C'; break;
2614             case 4:
2615                 m_InputCell.param = KLCoilTypeLR; curTaskState = 'C'; break;
2616             case 5:
2617                 strParam = _T(" P"); curTaskState = 'C'; break;
2618             case 6:
2619                 m_InputCell.param = KLCoilTypeT; curTaskState = 'C'; break;
2620             case 7:
2621                 m_InputCell.param = KLCoilTypeC; curTaskState = 'C'; break;
2622             case 8:
2623                 strParam = _T(" E"); curTaskState = 'C'; break;
2624             case 9:
2625                 m_InputCell.param = OP_TMX; curTaskState = 'C'; break;
2626             case 0x0a:
2627                 m_InputCell.param = OP_TMY; curTaskState = 'C'; break;
2628             case 0x0b:
2629                 m_InputCell.param = OP_TMR; curTaskState = 'C'; break;
2630             case 0x0c:
2631                 m_InputCell.param = OP_TML; curTaskState = 'C'; break;
2632             case 0x0d:
2633                 if ((lastLParam == 0x03) || (lastLParam == 0x06) || (lastLParam == 0x07) || (lastLParam == 0x08) || (lastLParam == 0x09))
2634                 {
2635                     m_InputCell.OP = CMTerm1View::typeNO;
2636                     m_InputCell.bnot = false;
2637                     m_InputCell.bpp = false;
2638                     m_InputCell.bpn = false;
2639                     clickCounter = 0;
2640                     clickCounterNot = 0;
2641                     clickCounterDF = 0;
2642                     clickCounterD = 0;
2643                     clickCounterF = 0;
2644                 }
2645                 lastLParam = 0x20;
2646                 m_InputCell.bcmpEq = true;
2647                 if (lastCMP != LParam)
2648                 {
2649                     clickCounterCMP++;
2650                 }
2651                 else
2652                 {
2653                     clickCounterCMP = 1;
2654                     m_InputCell.bcmpGt = false;
2655                     m_InputCell.bcmpLt = false;
2656                 }
2657
2658                 if (clickCounterCMP > 2)
2659                 {
2660                     clickCounterCMP = 1;
2661                     m_InputCell.bcmpGt = false;
2662                     m_InputCell.bcmpLt = false;
2663                 }
2664                 lastCMP = LParam;
2665                 curTaskState = 'B'; break;
2666             case 0x0e:
2667                 if ((lastLParam == 0x03) || (lastLParam == 0x06) || (lastLParam == 0x07) || (lastLParam == 0x08) || (lastLParam == 0x09))
2668                 {
2669                     m_InputCell.OP = CMTerm1View::typeNO;
2670                     m_InputCell.bnot = false;
2671                     m_InputCell.bpp = false;
2672                     m_InputCell.bpn = false;
2673                     clickCounter = 0;
2674                     clickCounterNot = 0;
2675                     clickCounterDF = 0;
2676                     clickCounterD = 0;
2677                     clickCounterF = 0;
2678                 }
2679                 lastLParam = 0x21;
2680                 m_InputCell.bcmpGt = true;
2681                 if (lastCMP != LParam)
2682                 {
2683                     clickCounterCMP++;
2684                 }
2685                 else
2686                 {
2687                     clickCounterCMP = 1;
2688                     m_InputCell.bcmpEq = false;
2689                     m_InputCell.bcmpLt = false;
2690                 }
2691                 if (clickCounterCMP > 2)
2692                 {
2693                     clickCounterCMP = 1;
2694                     m_InputCell.bcmpEq = false;
2695                     m_InputCell.bcmpLt = false;
2696                 }
2697                 lastCMP = LParam;
2698                 curTaskState = 'B'; break;
2699             case 0x0f:
2700                 if ((lastLParam == 0x03) || (lastLParam == 0x06) || (lastLParam == 0x07) || (lastLParam == 0x08) || (lastLParam == 0x09))
2701                 {
2702                     m_InputCell.OP = CMTerm1View::typeNO;
2703                     m_InputCell.bnot = false;
2704                     m_InputCell.bpp = false;
2705                     m_InputCell.bpn = false;
2706                     clickCounter = 0;
2707                     clickCounterNot = 0;
2708                     clickCounterDF = 0;
2709                     clickCounterD = 0;
2710                     clickCounterF = 0;
2711                 }
2712                 lastLParam = 0x22;
2713                 m_InputCell.bcmpLt = true;
2714                 if (lastCMP != LParam)
2715                 {
2716                     clickCounterCMP++;
2717                 }
2718                 else
2719                 {
2720                     clickCounterCMP = 1;
2721                     m_InputCell.bcmpEq = false;
2722                     m_InputCell.bcmpGt = false;
2723                 }
2724                 if (clickCounterCMP > 2)
2725                 {
2726                     clickCounterCMP = 1;
2727                     m_InputCell.bcmpEq = false;
2728                     m_InputCell.bcmpGt = false;
2729                 }
2730                 lastCMP = LParam;
2731                 curTaskState = 'B'; break;
2732             default:
2733                 break;
2734             }
2735             if (curTaskState != 'D')
2736             {
2737                 m_InputCell.num.Empty();
2738             }
2739         }
2740         else if (HParam == 0x3)
2741         {
2742             switch (LParam)
2743             {
2744             case 0:
2745                 strNumTemp = _T("0"); curTaskState = 'D'; break;
2746             case 1:
2747                 strNumTemp = _T("1"); curTaskState = 'D'; break;
2748             case 2:
2749                 strNumTemp = _T("2"); curTaskState = 'D'; break;
2750             case 3:
2751                 strNumTemp = _T("3"); curTaskState = 'D'; break;
2752             case 4:
2753                 strNumTemp = _T("4"); curTaskState = 'D'; break;
2754             case 5:
2755                 strNumTemp = _T("5"); curTaskState = 'D'; break;
2756             case 6:
2757                 strNumTemp = _T("6"); curTaskState = 'D'; break;
2758             case 7:
2759                 strNumTemp = _T("7"); curTaskState = 'D'; break;
2760             case 8:
2761                 strNumTemp = _T("8"); curTaskState = 'D'; break;
2762             case 9:
2763                 strNumTemp = _T("9"); curTaskState = 'D'; break;
2764             case 0x0A:
2765                 if ((m_InputCell.param == KLCoilTypeT) || (m_InputCell.param == KLCoilTypeC))
2766                     ;                        //state not change
2767                 else
2768                 {
2769                     strNumTemp = _T("A"); curTaskState = 'D';
2770                 }
2771                 break;
2772             case 0x0B:
2773                 if ((m_InputCell.param == KLCoilTypeT) || (m_InputCell.param == KLCoilTypeC))
2774                     ;
2775                 else
2776                 {
2777                     strNumTemp = _T("B"); curTaskState = 'D';
2778                 }
2779                 break;
2780             case 0x0C:
2781                 if ((m_InputCell.param == KLCoilTypeT) || (m_InputCell.param == KLCoilTypeC))
2782                     ;
2783                 else
2784                 {
2785                     strNumTemp = _T("C"); curTaskState = 'D';
2786                 }
2787                 break;
2788             case 0x0D:
2789                 if ((m_InputCell.param == KLCoilTypeT) || (m_InputCell.param == KLCoilTypeC))
2790                     ;
2791                 else
2792                 {
2793                     strNumTemp = _T("D"); curTaskState = 'D';
2794                 }
2795                 break;
2796
2797             case 0x0E:
2798                 if ((m_InputCell.param == KLCoilTypeT) || (m_InputCell.param == KLCoilTypeC))
2799                     ;
2800                 else
2801                 {
2802                     strNumTemp = _T("E"); curTaskState = 'D';
2803                 }
2804                 break;
2805             case 0x0F:
2806                 if ((m_InputCell.param == KLCoilTypeT) || (m_InputCell.param == KLCoilTypeC))
2807                     ;
2808                 else
2809                 {
2810                     strNumTemp = _T("F"); curTaskState = 'D';
2811                 }
2812                 break;
2813             default:
2814                 break;
2815             }
2816
2817             if (m_InputCell.num.GetLength() < 4)
2818             {
2819                 m_InputCell.num.Append(strNumTemp);
2820             }
2821             else
2822             {
2823                 m_InputCell.num = m_InputCell.num.Right(m_InputCell.num.GetLength() - 1);
2824                 m_InputCell.num.Append(strNumTemp);
2825
2826                 for (int i = 0; i < m_InputCell.num.GetLength(); i++)
2827                 {
2828                     if (m_InputCell.num[i] == _T('0'))
2829                     {
2830                         ;
2831                     }
2832                     else
2833                     {
2834                         flag = 1; break;
2835                     }
2836
2837                 }
2838                 if (flag == 0)
2839                 {
2840                     m_InputCell.num.Empty();
2841                     m_InputCell.num.Append(_T("0"));
2842                 }
2843             }
2844             int num = m_InputCell.num.GetLength();
2845             for (int i = 0; i < num; i++)
2846             {
2847                 int len1 = m_InputCell.num.GetLength();
2848                 if (len1 > 1 && m_InputCell.num[0] == _T('0')) m_InputCell.num = m_InputCell.num.Right(m_InputCell.num.GetLength() - 1);
2849             }
2850
2851         }
2852
2853
2854         break;
2855     }    //end switch
2856     if (HParam == 0x14)
2857     {
2858         bool editEndFlag = false;                                              //********************************************************************************************************
2859
2860         switch (m_InputCell.OP)
2861         {
2862         case CMTerm1View::typeNO:
2863         case CMTerm1View::typeNC:
2864         case CMTerm1View::typeOUT:
2865         case CMTerm1View::typeSET:
2866         case CMTerm1View::typeRESET:
2867         case CMTerm1View::typeTM:
2868             if (curTaskState == 'D')
2869             {
2870                 editEndFlag = true;
2871             }
2872         case CMTerm1View::typeDF:
2873         case CMTerm1View::typeDF_:
2874             if (curTaskState == 'A')
2875             {
2876                 editEndFlag = true;
2877             }
2878         default:
2879             break;
2880         }
2881
2882         if ((m_InputCell.bcmpEq) || (m_InputCell.bcmpGt) || (m_InputCell.bcmpLt))
2883         {
2884             editEndFlag = true;
2885         }
2886
2887         if (editEndFlag)
2888         {
2889             CMainFrame* p1 = (CMainFrame*)AfxGetMainWnd();
2890             p1->GetInputCell(m_InputCell);
2891         }
2892         else
2893         {
2894             CMainFrame* p1 = (CMainFrame*)AfxGetMainWnd();
2895             CString str = _T("无法确定指令输入");
2896             //p1->m_wndStatusBar.GetStatusBarCtrl().SetBkColor(RGB(255, 0, 0)); 
2897             p1->m_wndStatusBar.SetPaneText(0, str);
2898         }
2899
2900     }
2901
2902     display(m_InputCell);
2903     return 0;
2904 }
2905
2906 int CMyFormInputShow::SetDisplay1(int inputInfo)
2907 {
2908     // TODO: 在此处添加实现代码.
2909
2910     return 0;
2911 }
2912
2913
2914 void CMyFormInputShow::OnBnClickedBtnAnd()
2915 {
2916
2917     SetDisplay(0x00010001);
2918
2919     SetBtnDisplay(1);
2920 }
2921
2922 void CMyFormInputShow::OnBnClickedBtnOr()
2923 {
2924
2925     //    CMainFrame* p1 = (CMainFrame*)AfxGetMainWnd();
2926     //    p1->GetInputInfo(0x00010002);
2927
2928     SetDisplay(0x00010002);
2929     SetBtnDisplay(1);
2930 }
2931
2932 void CMyFormInputShow::OnBnClickedBtnVline()
2933 {
2934
2935     CMainFrame* p1 = (CMainFrame*)AfxGetMainWnd();
2936     //p1->GetInputInfo(_T("|"));
2937 }
2938
2939 void CMyFormInputShow::OnBnClickedBtnOut()
2940 {
2941
2942     CMainFrame* p1 = (CMainFrame*)AfxGetMainWnd();
2943     p1->GetInputInfo(0x00010003);
2944
2945     SetDisplay(0x00010003);
2946     SetBtnDisplay(1);
2947 }
2948 void CMyFormInputShow::OnBnClickedBtnTmCt()
2949 {
2950
2951     CMainFrame* p1 = (CMainFrame*)AfxGetMainWnd();
2952     p1->GetInputInfo(0x0001000b);
2953
2954     SetDisplay(0x0001000b);
2955
2956     SetBtnDisplay(5);
2957 }
2958 void CMyFormInputShow::OnBnClickedBtnFun()
2959 {
2960
2961     CMainFrame* p1 = (CMainFrame*)AfxGetMainWnd();
2962     //p1->GetInputInfo(_T("Fun "));
2963 }
2964 void CMyFormInputShow::OnBnClickedBtnHLine()
2965 {
2966
2967     CMainFrame* p1 = (CMainFrame*)AfxGetMainWnd();
2968     //p1->GetInputInfo(_T("——"));
2969 }
2970 void CMyFormInputShow::OnBnClickedBtnNot()                  /****************************************************************************/
2971 {
2972
2973     CMainFrame* p1 = (CMainFrame*)AfxGetMainWnd();
2974     p1->GetInputInfo(0x00010013);
2975
2976     SetDisplay(0x00010013);
2977
2978     SetBtnDisplay(1);
2979 }
2980 void CMyFormInputShow::OnBnClickedBtnIndex()
2981 {
2982
2983     CMainFrame* p1 = (CMainFrame*)AfxGetMainWnd();
2984     //p1->GetInputInfo(_T("Index "));
2985     SetBtnDisplay(4);
2986 }
2987 void CMyFormInputShow::OnBnClickedBtnMc()
2988 {
2989
2990     CMainFrame* p1 = (CMainFrame*)AfxGetMainWnd();
2991     p1->GetInputInfo(0x00010004);
2992
2993     SetDisplay(0x00010004);
2994 }
2995 void CMyFormInputShow::OnBnClickedBtnMce()
2996 {
2997
2998     CMainFrame* p1 = (CMainFrame*)AfxGetMainWnd();
2999     p1->GetInputInfo(0x00010005);
3000
3001     SetDisplay(0x00010005);
3002 }
3003 void CMyFormInputShow::OnBnClickedBtnSet()
3004 {
3005
3006     CMainFrame* p1 = (CMainFrame*)AfxGetMainWnd();
3007     p1->GetInputInfo(0x00010006);
3008
3009     SetDisplay(0x00010006);
3010     SetBtnDisplay(1);
3011 }
3012 void CMyFormInputShow::OnBnClickedBtnReset()
3013 {
3014
3015     CMainFrame* p1 = (CMainFrame*)AfxGetMainWnd();
3016     p1->GetInputInfo(0x00010007);
3017
3018     SetDisplay(0x00010007);
3019
3020     SetBtnDisplay(1);
3021 }
3022 void CMyFormInputShow::OnBnClickedBtnDf()
3023 {
3024
3025
3026     CMainFrame* p1 = (CMainFrame*)AfxGetMainWnd();
3027     p1->GetInputInfo(0x00010008);
3028
3029     SetDisplay(0x00010008);
3030
3031
3032     //p1->GetInputInfo(_T("(DF)"));
3033 }
3034 void CMyFormInputShow::OnBnClickedBtnEnd()
3035 {
3036
3037     CMainFrame* p1 = (CMainFrame*)AfxGetMainWnd();
3038     p1->GetInputInfo(0x0001000A);
3039
3040     SetDisplay(0x0001000A);
3041 }
3042 void CMyFormInputShow::OnBnClickedBtnCompare()
3043 {
3044
3045     CMainFrame* p1 = (CMainFrame*)AfxGetMainWnd();
3046     //p1->GetInputInfo(_T("Compare"));
3047     SetBtnDisplay(2);
3048 }
3049 void CMyFormInputShow::OnBnClickedBtnPFun()
3050 {
3051
3052     CMainFrame* p1 = (CMainFrame*)AfxGetMainWnd();
3053     //p1->GetInputInfo(_T("PFun"));
3054 }
3055 void CMyFormInputShow::OnBnClickedBtnUpDown()
3056 {
3057
3058     CMainFrame* p1 = (CMainFrame*)AfxGetMainWnd();
3059     p1->GetInputInfo(0x00010010);
3060
3061     SetDisplay(0x00010010);
3062
3063     SetBtnDisplay(1);
3064 }
3065 void CMyFormInputShow::OnBnClickedBtnBit()
3066 {
3067
3068     CMainFrame* p1 = (CMainFrame*)AfxGetMainWnd();
3069     //p1->GetInputInfo(_T("Bit"));
3070     SetBtnDisplay(1);
3071 }
3072 void CMyFormInputShow::OnBnClickedBtnWord()
3073 {
3074
3075     CMainFrame* p1 = (CMainFrame*)AfxGetMainWnd();
3076     //p1->GetInputInfo(_T("Word"));
3077     SetBtnDisplay(3);
3078 }
3079 void CMyFormInputShow::OnBnClickedBtnInc1()
3080 {
3081
3082     CMainFrame* p1 = (CMainFrame*)AfxGetMainWnd();
3083     //p1->GetInputInfo(_T("Inc1"));
3084 }
3085 void CMyFormInputShow::OnBnClickedBtnInc2()
3086 {
3087
3088     CMainFrame* p1 = (CMainFrame*)AfxGetMainWnd();
3089     //p1->GetInputInfo(_T("Inc2"));
3090 }
3091
3092
3093 void CMyFormInputShow::OnBnClickedBtnPgConvert()
3094 {
3095
3096     CMainFrame* p1 = (CMainFrame*)AfxGetMainWnd();
3097     //p1->GetInputInfo(_T("PgConvert"));
3098 }
3099 void CMyFormInputShow::OnBnClickedBtnOnline()
3100 {
3101
3102     CMainFrame* p1 = (CMainFrame*)AfxGetMainWnd();
3103     //p1->GetInputInfo(_T("Online"));
3104 }
3105 void CMyFormInputShow::OnBnClickedBtnOffline()
3106 {
3107
3108     CMainFrame* p1 = (CMainFrame*)AfxGetMainWnd();
3109     //p1->GetInputInfo(_T("Offline"));
3110 }
3111 void CMyFormInputShow::OnBnClickedBtnClose()
3112 {
3113
3114     CMainFrame* p1 = (CMainFrame*)AfxGetMainWnd();
3115     //p1->GetInputInfo(_T("Close"));
3116 }
3117 void CMyFormInputShow::OnBnClickedBtnFind()
3118 {
3119
3120     CMainFrame* p1 = (CMainFrame*)AfxGetMainWnd();
3121     //p1->GetInputInfo(_T("Find"));
3122 }
3123 void CMyFormInputShow::OnBnClickedBtnNextWin()
3124 {
3125
3126     CMainFrame* p1 = (CMainFrame*)AfxGetMainWnd();
3127     //p1->GetInputInfo(_T("NextWin"));
3128 }
3129 void CMyFormInputShow::OnBnClickedBtnMonitor()
3130 {
3131
3132     CMainFrame* p1 = (CMainFrame*)AfxGetMainWnd();
3133     //p1->GetInputInfo(_T("Monitor"));
3134 }
3135 void CMyFormInputShow::OnBnClickedBtnStatus()
3136 {
3137
3138     CMainFrame* p1 = (CMainFrame*)AfxGetMainWnd();
3139     //p1->GetInputInfo(_T("Status"));
3140 }
3141 void CMyFormInputShow::OnBnClickedBtnRunProg()
3142 {
3143
3144     CMainFrame* p1 = (CMainFrame*)AfxGetMainWnd();
3145     //p1->GetInputInfo(_T("RunProg"));
3146 }
3147 void CMyFormInputShow::OnBnClickedBtnPlcRead()
3148 {
3149
3150     CMainFrame* p1 = (CMainFrame*)AfxGetMainWnd();
3151     //p1->GetInputInfo(_T("PlcRead"));
3152 }
3153 void CMyFormInputShow::OnBnClickedBtnPlcWrite()
3154 {
3155
3156     CMainFrame* p1 = (CMainFrame*)AfxGetMainWnd();
3157     //p1->GetInputInfo(_T("PlcWrite"));
3158 }
3159
3160
3161 void CMyFormInputShow::OnBnClickedBtnX()
3162 {
3163
3164     CMainFrame* p1 = (CMainFrame*)AfxGetMainWnd();
3165     p1->GetInputInfo(0x00020001);
3166
3167     SetDisplay(0x00020001);
3168 }
3169 void CMyFormInputShow::OnBnClickedBtnY()
3170 {
3171
3172     CMainFrame* p1 = (CMainFrame*)AfxGetMainWnd();
3173     p1->GetInputInfo(0x00020002);
3174
3175     SetDisplay(0x00020002);
3176 }
3177 void CMyFormInputShow::OnBnClickedBtnR()
3178 {
3179
3180     CMainFrame* p1 = (CMainFrame*)AfxGetMainWnd();
3181     p1->GetInputInfo(0x00020003);
3182
3183     SetDisplay(0x00020003);
3184 }
3185 void CMyFormInputShow::OnBnClickedBtnL()
3186 {
3187
3188     CMainFrame* p1 = (CMainFrame*)AfxGetMainWnd();
3189     p1->GetInputInfo(0x00020004);
3190
3191     SetDisplay(0x00020004);
3192 }
3193 void CMyFormInputShow::OnBnClickedBtnP()
3194 {
3195
3196     CMainFrame* p1 = (CMainFrame*)AfxGetMainWnd();
3197     p1->GetInputInfo(0x00020005);
3198
3199     SetDisplay(0x00020005);
3200 }
3201
3202 void CMyFormInputShow::OnBnClickedBtnCompare1()
3203 {
3204     SetBtnDisplay(2);
3205 }
3206 void CMyFormInputShow::OnBnClickedBtnT()
3207 {
3208
3209     CMainFrame* p1 = (CMainFrame*)AfxGetMainWnd();
3210     p1->GetInputInfo(0x00020006);
3211
3212     SetDisplay(0x00020006);
3213 }
3214 void CMyFormInputShow::OnBnClickedBtnC()
3215 {
3216
3217     CMainFrame* p1 = (CMainFrame*)AfxGetMainWnd();
3218     p1->GetInputInfo(0x00020007);
3219
3220     SetDisplay(0x00020007);
3221 }
3222 void CMyFormInputShow::OnBnClickedBtnE()
3223 {
3224
3225     CMainFrame* p1 = (CMainFrame*)AfxGetMainWnd();
3226     p1->GetInputInfo(0x00020008);
3227
3228     SetDisplay(0x00020008);
3229 }
3230
3231
3232 void CMyFormInputShow::OnBnClickedBtnTmx()
3233 {
3234     CMainFrame* p1 = (CMainFrame*)AfxGetMainWnd();
3235     p1->GetInputInfo(0x00020009);
3236
3237     SetDisplay(0x00020009);
3238     SetBtnDisplay(0);
3239 }
3240 void CMyFormInputShow::OnBnClickedBtnTmy()
3241 {
3242     CMainFrame* p1 = (CMainFrame*)AfxGetMainWnd();
3243     p1->GetInputInfo(0x0002000A);
3244
3245     SetDisplay(0x0002000A);
3246     SetBtnDisplay(1);
3247 }
3248 void CMyFormInputShow::OnBnClickedBtnTmr()
3249 {
3250     CMainFrame* p1 = (CMainFrame*)AfxGetMainWnd();
3251     p1->GetInputInfo(0x0002000B);
3252
3253     SetDisplay(0x0002000B);
3254     SetBtnDisplay(0);
3255 }
3256 void CMyFormInputShow::OnBnClickedBtnTml()
3257 {
3258     CMainFrame* p1 = (CMainFrame*)AfxGetMainWnd();
3259     p1->GetInputInfo(0x0002000C);
3260
3261     SetDisplay(0x0002000C);
3262     SetBtnDisplay(0);
3263 }
3264 void CMyFormInputShow::OnBnClickedBtnCt()
3265 {
3266     CMainFrame* p1 = (CMainFrame*)AfxGetMainWnd();
3267     p1->GetInputInfo(0x0002000D);
3268
3269     SetDisplay(0x0002000D);
3270
3271     SetBtnDisplay(0);
3272 }
3273
3274
3275 void CMyFormInputShow::OnBnClickedBtnD()
3276 {
3277     CMainFrame* p1 = (CMainFrame*)AfxGetMainWnd();
3278     p1->GetInputInfo(0x00010015);
3279
3280     SetDisplay(0x00010015);
3281
3282 }
3283 void CMyFormInputShow::OnBnClickedBtnF()
3284 {
3285     CMainFrame* p1 = (CMainFrame*)AfxGetMainWnd();
3286     p1->GetInputInfo(0x00010016);
3287
3288     SetDisplay(0x00010016);
3289
3290 }
3291 void CMyFormInputShow::OnBnClickedBtnNEQ()
3292 {
3293     CMainFrame* p1 = (CMainFrame*)AfxGetMainWnd();
3294     p1->GetInputInfo(0x0002000D);
3295
3296     SetDisplay(0x0002000D);
3297 }
3298
3299 void CMyFormInputShow::OnBnClickedBtnGT()
3300 {
3301     CMainFrame* p1 = (CMainFrame*)AfxGetMainWnd();
3302     p1->GetInputInfo(0x0002000E);
3303
3304     SetDisplay(0x0002000E);
3305 }
3306 void CMyFormInputShow::OnBnClickedBtnLT()
3307 {
3308     CMainFrame* p1 = (CMainFrame*)AfxGetMainWnd();
3309     p1->GetInputInfo(0x0002000F);
3310
3311     SetDisplay(0x0002000F);
3312 }
3313
3314
3315 void CMyFormInputShow::OnBtn0()
3316 {
3317     // TODO: 在此添加命令处理程序代码
3318     SetDisplay(0x00030000);
3319 }
3320 void CMyFormInputShow::OnBtn1()
3321 {
3322     // TODO: 在此添加命令处理程序代码
3323     SetDisplay(0x00030001);
3324 }
3325 void CMyFormInputShow::OnBtn2()
3326 {
3327     // TODO: 在此添加命令处理程序代码
3328     SetDisplay(0x00030002);
3329 }
3330 void CMyFormInputShow::OnBtn3()
3331 {
3332     // TODO: 在此添加命令处理程序代码
3333     SetDisplay(0x00030003);
3334 }
3335 void CMyFormInputShow::OnBtn4()
3336 {
3337     // TODO: 在此添加命令处理程序代码
3338     SetDisplay(0x00030004);
3339 }
3340 void CMyFormInputShow::OnBtn5()
3341 {
3342     // TODO: 在此添加命令处理程序代码
3343     SetDisplay(0x00030005);
3344 }
3345 void CMyFormInputShow::OnBtn6()
3346 {
3347     // TODO: 在此添加命令处理程序代码
3348     SetDisplay(0x00030006);
3349 }
3350 void CMyFormInputShow::OnBtn7()
3351 {
3352     // TODO: 在此添加命令处理程序代码
3353     SetDisplay(0x00030007);
3354 }
3355 void CMyFormInputShow::OnBtn8()
3356 {
3357     // TODO: 在此添加命令处理程序代码
3358     SetDisplay(0x00030008);
3359 }
3360 void CMyFormInputShow::OnBtn9()
3361 {
3362     // TODO: 在此添加命令处理程序代码
3363     SetDisplay(0x00030009);
3364 }
3365 void CMyFormInputShow::OnBtnA()
3366 {
3367     // TODO: 在此添加命令处理程序代码
3368     SetDisplay(0x0003000A);
3369 }
3370 void CMyFormInputShow::OnBtnB()
3371 {
3372     // TODO: 在此添加命令处理程序代码
3373     SetDisplay(0x0003000B);
3374 }
3375 void CMyFormInputShow::OnBtnC()
3376 {
3377     // TODO: 在此添加命令处理程序代码
3378     SetDisplay(0x0003000C);
3379 }
3380
3381 void CMyFormInputShow::OnBtnD()
3382 {
3383     // TODO: 在此添加命令处理程序代码
3384     SetDisplay(0x0003000D);
3385 }
3386 void CMyFormInputShow::OnBtnE()
3387 {
3388     // TODO: 在此添加命令处理程序代码
3389     SetDisplay(0x0003000E);
3390 }
3391 void CMyFormInputShow::OnBtnF()
3392 {
3393     // TODO: 在此添加命令处理程序代码
3394
3395     SetDisplay(0x0003000F);
3396 }
3397 void CMyFormInputShow::OnBtnMinus()
3398 {
3399     // TODO: 在此添加命令处理程序代码
3400     //m_wndDlgBar_InputShow.SetDisplay(_T("-"));
3401 }
3402 void CMyFormInputShow::OnBtnDot()
3403 {
3404     // TODO: 在此添加命令处理程序代码
3405     //m_wndDlgBar_InputShow.SetDisplay(_T("."));
3406 }
3407
3408
3409 void CMyFormInputShow::OnChar(UINT nChar, UINT nRepCnt, UINT nFlags)
3410 {
3411     // TODO: 在此添加消息处理程序代码和/或调用默认值
3412     if (nChar == 13) { OnBtnRet(); }
3413     CFormView::OnChar(nChar, nRepCnt, nFlags);
3414 }