Yao Chunli
2022-06-21 e00d5a1575d26f8fec1be6fa8a844203cd66a24c
MTerm2/MyDlgBarInputShow.cpp
@@ -5,9 +5,14 @@
#include "MTerm2.h"
#include "MyDlgBarInputShow.h"
#include "afxdialogex.h"
#include "KDefine.h"
#include "MTerm2View.h"
#include "MainFrm.h"
// CMyDlgBarInputShow 对话框
IMPLEMENT_DYNAMIC(CMyDlgBarInputShow, CDialogBar)
@@ -23,11 +28,3208 @@
void CMyDlgBarInputShow::DoDataExchange(CDataExchange* pDX)
{
   CDialogBar::DoDataExchange(pDX);
   DDX_Control(pDX, IDC_EDIT_INPUT, m_edit_input);
}
BEGIN_MESSAGE_MAP(CMyDlgBarInputShow, CDialogBar)
END_MESSAGE_MAP()
// CMyDlgBarInputShow 消息处理程序
//SetDlgItemText(IDC_EDIT_INPUT, myButtons[0][0].sCaption);
int flag = 0;
int CMyDlgBarInputShow::SetDisplay(int inputInfo)
{
   /*stInputCell.OP = CMTerm2View::typeNO;
   stInputCell.param = KLCoilTypeY;
   stInputCell.num = _T("1234");*/
   static int clickCounter = 0;
   static int clickCounterDF = 0;
   static int clickCounterNot = 0;
   static int clickCounterCMP = 0;
   static int clickCounterD = 0;
   static int clickCounterF = 0;
   static char curTaskState = 'A';
   static int lastLParam = 0;
   static int lastCMP = 0;
   static CString str, strStoreB, strStoreC, strNum;
   static CString strOp, strParam;
   CString s1, strNumTemp;
   int para = 0;
   int HParam, LParam;
   s1.Format(_T("is this window %d"), IsWindow(m_hWnd));
   SysLog(s1);
   //   ChangeState(inputInfo>>16, lastTaskState, curTaskState);
   if (inputInfo == 0x00010008)
   {
      clickCounterDF++;
      if (clickCounterDF == 1)                     //DF  redefine key value
      {
         inputInfo = 0x00010008;
      }
      else if (clickCounterDF == 2)
      {
         inputInfo = 0x00010009;
         clickCounterDF = 0;
      }
   }
   if (inputInfo == 0x00010010)
   {
      clickCounter++;
      if (clickCounter == 1)  //updown  redefine key value
      {
         inputInfo = 0x00010010;
      }
      else if (clickCounter == 2)
      {
         inputInfo = 0x00010011;
      }
      else if (clickCounter == 3)
      {
         inputInfo = 0x00010012;
         clickCounter = 0;
      }
   }
   if (inputInfo == 0x00010013)
   {
      clickCounterNot++;
      if (clickCounterNot == 1)                     //NOT  redefine key value
      {
         inputInfo = 0x00010013;
      }
      else if (clickCounterNot == 2)
      {
         inputInfo = 0x00010014;
         clickCounterNot = 0;
      }
   }
   if (inputInfo == 0x00010015)
   {
      clickCounterD++;
      if (clickCounterD == 1)                     //D  redefine key value
      {
         inputInfo = 0x00010015;
      }
      else if (clickCounterD == 2)
      {
         inputInfo = 0x00010017;
         clickCounterD = 0;
      }
   }
   if (inputInfo == 0x00010016)
   {
      clickCounterF++;
      if (clickCounterF== 1)                     //D  redefine key value
      {
         inputInfo = 0x00010016;
      }
      else if (clickCounterF == 2)
      {
         inputInfo = 0x00010018;
         clickCounterF = 0;
      }
   }
   HParam = inputInfo >> 16;
   LParam = inputInfo & 0xffff;
   switch (curTaskState)
   {
   case 'A':
      if (HParam == 0x1)                      //operator 1
      {
         stInputCell.bnot = false;
         stInputCell.bpp = false;
         stInputCell.bpn = false;
         stInputCell.bcmpEq = false;
         stInputCell.bcmpLt = false;
         stInputCell.bcmpGt = false;
         stInputCell.bDouble = false;
         stInputCell.bDouble1 = false;
         stInputCell.bFloat = false;
         stInputCell.bFloat1 = false;
         stInputCell.bLeftLineUp = false;
         stInputCell.brightLineUp = false;
         if ((LParam>=0x1)&& (LParam <= 0x0f))
         {
            if ((LParam == 0x8) || (LParam == 0x9))         //IF DF  not clear df
            {
               clickCounter = 0;
               clickCounterNot = 0;
               clickCounterCMP = 0;
               clickCounterD = 0;
               clickCounterF = 0;
            }
            else
            {
               if (lastLParam != LParam)
               {
                  clickCounter = 0;
                  clickCounterNot = 0;
                  clickCounterDF = 0;
                  clickCounterCMP = 0;
                  clickCounterD = 0;
                  clickCounterF = 0;
               }
            }
         }
         if ((lastLParam == 0x14) && ((LParam == 0x10) || (LParam == 0x11) || (LParam == 0x12)))  //from not to updown
         {
            clickCounter = 1;
            clickCounterNot = 0;
            clickCounterDF = 0;
            clickCounterCMP = 0;
            clickCounterD = 0;
            clickCounterF = 0;
         }
         if ((lastLParam == 0x10) && ((LParam == 0x13) || (LParam == 0x14)))    //from up to not
         {
            clickCounter = 0;
            clickCounterNot = 1;
            clickCounterDF = 0;
            clickCounterCMP = 0;
            clickCounterD = 0;
            clickCounterF = 0;
         }
         if ((lastLParam == 0x11) && ((LParam == 0x13) || (LParam == 0x14)))    //from down to not
         {
            clickCounter = 0;
            clickCounterNot = 1;
            clickCounterDF = 0;
            clickCounterCMP = 0;
            clickCounterD = 0;
            clickCounterF = 0;
         }
         if ((lastLParam == 0x13) && ((LParam == 0x10)|| (LParam == 0x11)|| (LParam == 0x12)))  //not
         {
            clickCounter = 0;
            clickCounterNot = 0;
            clickCounterDF = 0;
            clickCounterCMP = 0;
            clickCounterD = 0;
            clickCounterF = 0;
         }
         if ((lastLParam == 0x10) && ((LParam == 0x13) || (LParam == 0x14)))    //updown
         {
            clickCounter = 0;
            clickCounterNot = 0;
            clickCounterDF = 0;
            clickCounterCMP = 0;
            clickCounterD = 0;
            clickCounterF = 0;
         }
         if ((lastLParam == 0x11) && ((LParam == 0x13) || (LParam == 0x14)))    //updown
         {
            clickCounter = 0;
            clickCounterNot = 0;
            clickCounterDF = 0;
            clickCounterCMP = 0;
            clickCounterD = 0;
            clickCounterF = 0;
         }
         if ((lastLParam == 0x15) && ((LParam == 0x16) || (LParam == 0x18)))  //D ,"", F,""
         {
            clickCounter = 0;
            clickCounterNot = 0;
            clickCounterDF = 0;
            clickCounterCMP = 0;
            clickCounterD = 0;
            clickCounterF = 1;
         }
         if ((lastLParam == 0x15)&&((LParam == 0x16)||(LParam == 0x18)))
         {
            clickCounter = 0;
            clickCounterNot = 0;
            clickCounterDF = 0;
            clickCounterCMP = 0;
            clickCounterD = 0;
            clickCounterF = 1;
         }
         if ((lastLParam == 0x17) && ((LParam == 0x16) || (LParam == 0x18)))
         {
            clickCounter = 0;
            clickCounterNot = 0;
            clickCounterDF = 0;
            clickCounterCMP = 0;
            clickCounterD = 0;
            clickCounterF = 1;
         }
         if ((lastLParam == 0x16) && ((LParam == 0x15) || (LParam == 0x17)))
         {
            clickCounter = 0;
            clickCounterNot = 0;
            clickCounterDF = 0;
            clickCounterCMP = 0;
            clickCounterD = 1;
            clickCounterF = 0;
         }
         if ((lastLParam == 0x18) && ((LParam == 0x15) || (LParam == 0x17)))
         {
            clickCounter = 0;
            clickCounterNot = 0;
            clickCounterDF = 0;
            clickCounterCMP = 0;
            clickCounterD = 1;
            clickCounterF = 0;
         }
         switch (LParam)
         {
         case 0x01:
            stInputCell.OP = CMTerm2View::typeNO; stInputCell.param= 0x10;      //0x10 define para null
            lastLParam = LParam;
            curTaskState = 'B';
            break;
         case 0x02:
            stInputCell.OP = CMTerm2View::typeNO; stInputCell.param = 0x10;
            stInputCell.bLeftLineUp = true;
            stInputCell.brightLineUp = true;
            lastLParam = LParam;
            curTaskState = 'B';
            break;
         case 0x03:
            stInputCell.OP = CMTerm2View::typeOUT; stInputCell.param = 0x10;
            lastLParam = LParam;
            curTaskState = 'B';
            break;
         /*case 4:
            strOp = _T("(MC)");strParam = "";lastLParam = LParam;curTaskState = 'C'; break;
         case 5:
            strOp = _T("(MCE)");strParam = "";lastLParam = LParam;curTaskState = 'C'; break;*/
         case 0x06:
            stInputCell.OP = CMTerm2View::typeSET; stInputCell.param = 0x10;
            lastLParam = LParam;curTaskState = 'B'; break;
         case 0x07:
            stInputCell.OP = CMTerm2View::typeRESET; stInputCell.param = 0x10;
            lastLParam = LParam;curTaskState = 'B'; break;
         case 0x08:
            stInputCell.OP = CMTerm2View::typeDF;stInputCell.param = 0x10;
            lastLParam = LParam;
            curTaskState = 'A';
            break;
         case 0x09:
            stInputCell.OP = CMTerm2View::typeDF_;stInputCell.param = 0x10;
            lastLParam = LParam;
            curTaskState = 'A';
            break;
         case 0x0a:
            strOp = _T("(ED)");strParam = "";lastLParam = LParam;curTaskState = 'A'; break;
         case 0x0b:
            stInputCell.OP = CMTerm2View::typeTM;stInputCell.param = 0x10;
            lastLParam = LParam;
            curTaskState = 'B';
            break;
         case 0x10:
            stInputCell.bpp = true;
            stInputCell.bpn = false;
            lastLParam = LParam;
            break;
         case 0x11:
            stInputCell.bpp = false;
            stInputCell.bpn = true;
            lastLParam = LParam;
            break;
         case 0x12:
            stInputCell.bpp = false;
            stInputCell.bpn = false;
            lastLParam = LParam;
            break;
         case 0x13:
            switch (lastLParam)
            {
            case 0x03:
            case 0x06:
            case 0x07:
            case 0x15:
            case 0x17:
            case 0x16:
            case 0x18:
            case 0x20:
            case 0x21:
            case 0x22:
               stInputCell.OP = CMTerm2View::typeNOT;
               clickCounterNot = 0;
               curTaskState = 'A';
            default:
               break;
            }
            switch (lastLParam)
            {
            case 0x01:
               stInputCell.OP = CMTerm2View::typeNC;break;
            case 0x02:
               stInputCell.OP = CMTerm2View::typeNC;
               stInputCell.bLeftLineUp = true;
               stInputCell.brightLineUp = true;
               break;
            default:
               break;
            }
            lastLParam = LParam;
            stInputCell.bnot = true;
            break;
         case 0x14:
            stInputCell.bnot = false;
            break;
         case 0x15:
            stInputCell.bDouble = true;
            stInputCell.bDouble1 = false;
            stInputCell.bFloat = false;
            stInputCell.bFloat1 = false;
            lastLParam = LParam;stInputCell.param = 0x10;curTaskState = 'B';
            break;
         case 0x17:
            stInputCell.bDouble = false;
            stInputCell.bDouble1 = true;
            stInputCell.bFloat = false;
            stInputCell.bFloat1 = false;
            lastLParam = LParam;stInputCell.param = 0x10;curTaskState = 'B';
            break;
         case 0x16:
            stInputCell.bDouble = false;
            stInputCell.bDouble1 = false;
            stInputCell.bFloat = true;
            stInputCell.bFloat1 = false;
            lastLParam = LParam;stInputCell.param = 0x10;curTaskState = 'B';
            break;
         case 0x18:
            stInputCell.bDouble = false;
            stInputCell.bDouble1 = false;
            stInputCell.bFloat = false;
            stInputCell.bFloat1 = true;
            lastLParam = LParam;stInputCell.param = 0x10;curTaskState = 'B';
            break;
         default:
            break;
         }
      }
      str = strOp;
      break;
   case 'B':
      str = strOp;
      if (HParam == 0x1)                      //operator 1
      {
         stInputCell.bnot = false;
         stInputCell.bpp = false;
         stInputCell.bpn = false;
         stInputCell.bcmpEq = false;
         stInputCell.bcmpLt = false;
         stInputCell.bcmpGt = false;
         stInputCell.bDouble = false;
         stInputCell.bDouble1 = false;
         stInputCell.bFloat = false;
         stInputCell.bFloat1 = false;
         stInputCell.bLeftLineUp = false;
         stInputCell.brightLineUp = false;
         if ((LParam >= 0x0) && (LParam <= 0x0f))
         {
            if ((LParam == 0x08) || (LParam ==0x09))
            {
               clickCounter = 0;
               clickCounterNot = 0;
               clickCounterCMP = 0;
               clickCounterD = 0;
               clickCounterF = 0;
            }
            else
            {
               if (lastLParam != LParam)
               {
                  clickCounter = 0;
                  clickCounterNot = 0;
                  clickCounterDF = 0;
                  clickCounterCMP = 0;
                  clickCounterD = 0;
                  clickCounterF = 0;
               }
            }
         }
         if ((lastLParam == 0x13) && ((LParam == 0x10) || (LParam == 0x11) || (LParam == 0x12)))  //from not to updown
         {
            clickCounter = 1;
            clickCounterNot = 0;
            clickCounterDF = 0;
            clickCounterCMP = 0;
            clickCounterD = 0;
            clickCounterF = 0;
         }
         if ((lastLParam == 0x14) && ((LParam == 0x10) || (LParam == 0x11) || (LParam == 0x12)))  //from not to updown
         {
            clickCounter = 1;
            clickCounterNot = 0;
            clickCounterDF = 0;
            clickCounterCMP = 0;
            clickCounterD = 0;
            clickCounterF = 0;
         }
         if ((lastLParam == 0x10) && ((LParam == 0x13) || (LParam == 0x14)))    //from up to not
         {
            clickCounter = 0;
            clickCounterNot = 1;
            clickCounterDF = 0;
            clickCounterCMP = 0;
            clickCounterD = 0;
            clickCounterF = 0;
         }
         if ((lastLParam == 0x11) && ((LParam == 0x13) || (LParam == 0x14)))    //from down to not
         {
            clickCounter = 0;
            clickCounterNot = 1;
            clickCounterDF = 0;
            clickCounterCMP = 0;
            clickCounterD = 0;
            clickCounterF = 0;
         }
         if ((lastLParam == 0x15) && ((LParam == 0x16) || (LParam == 0x18)))
         {
            clickCounter = 0;
            clickCounterNot = 0;
            clickCounterDF = 0;
            clickCounterCMP = 0;
            clickCounterD = 0;
            clickCounterF = 1;
         }
         if ((lastLParam == 0x17) && ((LParam == 0x16) || (LParam == 0x18)))
         {
            clickCounter = 0;
            clickCounterNot = 0;
            clickCounterDF = 0;
            clickCounterCMP = 0;
            clickCounterD = 0;
            clickCounterF = 1;
         }
         if ((lastLParam == 0x16) && ((LParam == 0x15) || (LParam == 0x17)))
         {
            clickCounter = 0;
            clickCounterNot = 0;
            clickCounterDF = 0;
            clickCounterCMP = 0;
            clickCounterD = 1;
            clickCounterF = 0;
         }
         if ((lastLParam == 0x18) && ((LParam == 0x15) || (LParam == 0x17)))
         {
            clickCounter = 0;
            clickCounterNot = 0;
            clickCounterDF = 0;
            clickCounterCMP = 0;
            clickCounterD = 1;
            clickCounterF = 0;
         }
         switch (LParam)
         {
         case 0x01:
            stInputCell.OP = CMTerm2View::typeNO; stInputCell.param = 0x10;      //0x10 define para null
            lastLParam = LParam;
            curTaskState = 'B';
            break;
         case 0x02:
            stInputCell.OP = CMTerm2View::typeNO; stInputCell.param = 0x10;
            stInputCell.bLeftLineUp = true;
            stInputCell.brightLineUp = true;
            lastLParam = LParam;
            curTaskState = 'B';
            break;
         case 0x03:
            stInputCell.OP = CMTerm2View::typeOUT; stInputCell.param = 0x10;
            lastLParam = LParam;
            curTaskState = 'B';
            break;
            /*case 4:
               strOp = _T("(MC)");strParam = "";lastLParam = LParam;curTaskState = 'C'; break;
            case 5:
               strOp = _T("(MCE)");strParam = "";lastLParam = LParam;curTaskState = 'C'; break;*/
         case 0x06:
            stInputCell.OP = CMTerm2View::typeSET; stInputCell.param = 0x10; ;lastLParam = LParam;curTaskState = 'B'; break;
         case 0x07:
            stInputCell.OP = CMTerm2View::typeRESET; stInputCell.param = 0x10; ;lastLParam = LParam;curTaskState = 'B'; break;
         case 0x08:
            stInputCell.OP = CMTerm2View::typeDF;;stInputCell.param = 0x10;
            lastLParam = LParam;
            curTaskState = 'A';
            break;
         case 0x9:
            stInputCell.OP = CMTerm2View::typeDF_;stInputCell.param = 0x10;
            lastLParam = LParam;
            curTaskState = 'A';
            break;
         case 0x0a:
            strOp = _T("(ED)");strParam = "";lastLParam = LParam;curTaskState = 'A'; break;
         case 0x0b:
            stInputCell.OP = CMTerm2View::typeTM;stInputCell.param = 0x10;
            lastLParam = LParam;
            curTaskState = 'B';
            break;
         case 0x10:
            stInputCell.bpp = true;
            stInputCell.bpn = false;
            lastLParam = LParam;
            break;
         case 0x11:
            stInputCell.bpp = false;
            stInputCell.bpn = true;
            lastLParam = LParam;
            break;
         case 0x12:
            stInputCell.bpp = false;
            stInputCell.bpn = false;
            lastLParam = LParam;
            break;
         case 0x13:
            switch (lastLParam)
            {
            case 0x03:
            case 0x06:
            case 0x07:
            case 0x15:
            case 0x17:
            case 0x16:
            case 0x18:
            case 0x20:
            case 0x21:
            case 0x22:
               stInputCell.OP = CMTerm2View::typeNOT;
               clickCounterNot = 0;
               curTaskState = 'A';
            default:
               break;
            }
            switch (lastLParam)
            {
            case 0x01:
               stInputCell.OP = CMTerm2View::typeNC;break;
            case 0x02:
               stInputCell.OP = CMTerm2View::typeNC;
               stInputCell.bLeftLineUp = true;
               stInputCell.brightLineUp = true;
               break;
            default:
               break;
            }
            lastLParam = LParam;
            stInputCell.bnot = true;
            break;
         case 0x14:
            stInputCell.bnot = false;
            break;
         case 0x15:
            stInputCell.bDouble = true;
            stInputCell.bDouble1 = false;
            stInputCell.bFloat = false;
            stInputCell.bFloat1 = false;
            stInputCell.param = 0x10;lastLParam = LParam;curTaskState = 'B';
            break;
         case 0x17:
            stInputCell.bDouble = false;
            stInputCell.bDouble1 = true;
            stInputCell.bFloat = false;
            stInputCell.bFloat1 = false;
            stInputCell.param = 0x10;lastLParam = LParam;curTaskState = 'B';
            break;
         case 0x16:
            stInputCell.bDouble = false;
            stInputCell.bDouble1 = false;
            stInputCell.bFloat = true;
            stInputCell.bFloat1 = false;
            lastLParam = LParam;stInputCell.param = 0x10;curTaskState = 'B';
            break;
         case 0x18:
            stInputCell.bDouble = false;
            stInputCell.bDouble1 = false;
            stInputCell.bFloat = false;
            stInputCell.bFloat1 = true;
            lastLParam = LParam;stInputCell.param = 0x10;curTaskState = 'B';
            break;
         default:
            break;
         }
      }
      else if (HParam == 0x2)
      {
         switch (LParam)
         {
         case 1:
            stInputCell.param = KLCoilTypeX;curTaskState = 'C'; break;
         case 2:
            stInputCell.param = KLCoilTypeY;curTaskState = 'C'; break;
         case 3:
            stInputCell.param = KLCoilTypeR;curTaskState = 'C'; break;
         case 4:
            stInputCell.param = KLCoilTypeLR; curTaskState = 'C';break;
         case 5:
            strParam = _T(" P");curTaskState = 'C'; break;
         case 6:
            stInputCell.param = KLCoilTypeT; curTaskState = 'C';break;
         case 7:
            stInputCell.param = KLCoilTypeC;curTaskState = 'C'; break;
         case 8:
            strParam = _T(" E");curTaskState = 'C'; break;
         case 9:
            stInputCell.param = OP_TMX;curTaskState = 'C'; break;
         case 0x0a:
            stInputCell.param = OP_TMY;curTaskState = 'C'; break;
         case 0x0b:
            stInputCell.param = OP_TMR;curTaskState = 'C'; break;
         case 0x0c:
            stInputCell.param = OP_TML;curTaskState = 'C'; break;
         case 0x0d:
            if ((lastLParam==0x03)|| (lastLParam == 0x06)|| (lastLParam == 0x07)|| (lastLParam == 0x08)|| (lastLParam == 0x09))
            {
               stInputCell.OP = CMTerm2View::typeNO;
               stInputCell.bnot = false;
               stInputCell.bpp = false;
               stInputCell.bpn = false;
               clickCounter = 0;
               clickCounterNot = 0;
               clickCounterDF = 0;
               clickCounterD = 0;
               clickCounterF = 0;
            }
            lastLParam = 0x20;
            stInputCell.bcmpEq = true;
            if(lastCMP!= LParam)
            {
            clickCounterCMP++;
              }
            else
            {
               clickCounterCMP = 1;
               stInputCell.bcmpGt = false;
               stInputCell.bcmpLt = false;
            }
            if (clickCounterCMP>2)
            {
               clickCounterCMP = 1;
               stInputCell.bcmpGt = false;
               stInputCell.bcmpLt = false;
            }
            lastCMP = LParam;
            curTaskState = 'B'; break;
         case 0x0e:
            if ((lastLParam == 0x03) || (lastLParam == 0x06) || (lastLParam == 0x07) || (lastLParam == 0x08) || (lastLParam == 0x09))
            {
               stInputCell.OP = CMTerm2View::typeNO;
               stInputCell.bnot = false;
               stInputCell.bpp = false;
               stInputCell.bpn = false;
               clickCounter = 0;
               clickCounterNot = 0;
               clickCounterDF = 0;
               clickCounterD = 0;
               clickCounterF = 0;
            }
            lastLParam = 0x21;
            stInputCell.bcmpGt = true;
            if (lastCMP != LParam)
            {
               clickCounterCMP++;
            }
            else
            {
               clickCounterCMP = 1;
               stInputCell.bcmpEq = false;
               stInputCell.bcmpLt = false;
            }
            if (clickCounterCMP > 2)
            {
               clickCounterCMP = 1;
               stInputCell.bcmpEq = false;
               stInputCell.bcmpLt = false;
            }
            lastCMP = LParam;
            curTaskState = 'B'; break;
         case 0x0f:
            if ((lastLParam == 0x03) || (lastLParam == 0x06) || (lastLParam == 0x07) || (lastLParam == 0x08) || (lastLParam == 0x09))
            {
               stInputCell.OP = CMTerm2View::typeNO;
               stInputCell.bnot = false;
               stInputCell.bpp = false;
               stInputCell.bpn = false;
               clickCounter = 0;
               clickCounterNot = 0;
               clickCounterDF = 0;
               clickCounterD = 0;
               clickCounterF = 0;
            }
            lastLParam = 0x22;                //  define op para; for translate to -/-
            stInputCell.bcmpLt = true;
            if (lastCMP != LParam)
            {
               clickCounterCMP++;
            }
            else
            {
               clickCounterCMP = 1;
               stInputCell.bcmpEq = false;
               stInputCell.bcmpGt = false;
            }
            if (clickCounterCMP > 2)
            {
               clickCounterCMP = 1;
               stInputCell.bcmpEq = false;
               stInputCell.bcmpGt = false;
            }
            lastCMP = LParam;             //record key num = > <
            curTaskState = 'B'; break;
         default:
            break;
         }
      }
      break;
   case 'C':
      //   str = strOp + _T(" ") + strParam;
      if (HParam == 0x01)                      //operator 1
      {
         stInputCell.bnot = false;
         stInputCell.bpp = false;
         stInputCell.bpn = false;
         stInputCell.bcmpEq = false;
         stInputCell.bcmpLt = false;
         stInputCell.bcmpGt = false;
         stInputCell.bDouble = false;
         stInputCell.bFloat1 = false;
         stInputCell.bFloat = false;
         stInputCell.bFloat1 = false;
         stInputCell.bLeftLineUp = false;
         stInputCell.brightLineUp = false;
         if ((LParam >= 0x01) && (LParam <= 0x0f))
         {
            if ((LParam == 0x08) || (LParam ==0x09))
            {
               clickCounter = 0;
               clickCounterNot = 0;
               clickCounterCMP = 0;
               clickCounterD = 0;
               clickCounterF = 0;
            }
            else
            {
               if (lastLParam != LParam)
               {
                  clickCounter = 0;
                  clickCounterNot = 0;
                  clickCounterDF = 0;
                  clickCounterCMP = 0;
                  clickCounterD = 0;
                  clickCounterF = 0;
               }
            }
         }
         if ((lastLParam == 0x14) && ((LParam == 0x10) || (LParam == 0x11) || (LParam == 0x12)))  //from not to updown
         {
            clickCounter = 1;
            clickCounterNot = 0;
            clickCounterDF = 0;
            clickCounterCMP = 0;
            clickCounterD = 0;
            clickCounterF = 0;
         }
         if ((lastLParam == 0x10) && ((LParam == 0x13) || (LParam == 0x14)))    //from up to not
         {
            clickCounter = 0;
            clickCounterNot = 1;
            clickCounterDF = 0;
            clickCounterCMP = 0;
            clickCounterD = 0;
            clickCounterF = 0;
         }
         if ((lastLParam == 0x11) && ((LParam == 0x13) || (LParam == 0x14)))    //from down to not
         {
            clickCounter = 0;
            clickCounterNot = 1;
            clickCounterDF = 0;
            clickCounterCMP = 0;
            clickCounterD = 0;
            clickCounterF = 0;
         }
         if ((lastLParam == 0x13) && ((LParam == 0x10) || (LParam == 0x11) || (LParam == 0x12)))  //not
         {
            clickCounter = 0;
            clickCounterNot = 0;
            clickCounterDF = 0;
            clickCounterCMP = 0;
            clickCounterD = 0;
            clickCounterF = 0;
         }
         if ((lastLParam == 0x10) && ((LParam == 0x13) || (LParam == 0x14)))    //updown
         {
            clickCounter = 0;
            clickCounterNot = 0;
            clickCounterDF = 0;
            clickCounterCMP = 0;
            clickCounterD = 0;
            clickCounterF = 0;
         }
         if ((lastLParam == 0x11) && ((LParam == 0x13) || (LParam == 0x14)))    //updown
         {
            clickCounter = 0;
            clickCounterNot = 0;
            clickCounterDF = 0;
            clickCounterCMP = 0;
            clickCounterD = 0;
            clickCounterF = 0;
         }
         if ((lastLParam == 0x15) && ((LParam == 0x16) || (LParam == 0x18)))
         {
            clickCounter = 0;
            clickCounterNot = 0;
            clickCounterDF = 0;
            clickCounterCMP = 0;
            clickCounterD = 0;
            clickCounterF = 1;
         }
         if ((lastLParam == 0x17) && ((LParam == 0x16) || (LParam == 0x18)))
         {
            clickCounter = 0;
            clickCounterNot = 0;
            clickCounterDF = 0;
            clickCounterCMP = 0;
            clickCounterD = 0;
            clickCounterF = 1;
         }
         if ((lastLParam == 0x16) && ((LParam == 0x15) || (LParam == 0x17)))
         {
            clickCounter = 0;
            clickCounterNot = 0;
            clickCounterDF = 0;
            clickCounterCMP = 0;
            clickCounterD = 1;
            clickCounterF = 0;
         }
         if ((lastLParam == 0x18) && ((LParam == 0x15) || (LParam == 0x17)))
         {
            clickCounter = 0;
            clickCounterNot = 0;
            clickCounterDF = 0;
            clickCounterCMP = 0;
            clickCounterD = 1;
            clickCounterF = 0;
         }
         switch (LParam)
         {
         case 0x01:
            stInputCell.OP = CMTerm2View::typeNO; stInputCell.param = 0x10;      //0x10 define para null
            lastLParam = LParam;
            curTaskState = 'B';
            break;
         case 0x02:
            stInputCell.OP = CMTerm2View::typeNO; stInputCell.param = 0x10;
            stInputCell.bLeftLineUp = true;
            stInputCell.brightLineUp = true;
            lastLParam = LParam;
            curTaskState = 'B';
            break;
         case 0x03:
            stInputCell.OP = CMTerm2View::typeOUT; stInputCell.param = 0x10;
            lastLParam = LParam;
            curTaskState = 'B';
            break;
            /*case 4:
               strOp = _T("(MC)");strParam = "";lastLParam = LParam;curTaskState = 'C'; break;
            case 5:
               strOp = _T("(MCE)");strParam = "";lastLParam = LParam;curTaskState = 'C'; break;*/
         case 0x06:
            stInputCell.OP = CMTerm2View::typeSET; stInputCell.param = 0x10; ;lastLParam = LParam;curTaskState = 'B'; break;
         case 0x07:
            stInputCell.OP = CMTerm2View::typeRESET; stInputCell.param = 0x10; ;lastLParam = LParam;curTaskState = 'B'; break;
         case 0x08:
            stInputCell.OP = CMTerm2View::typeDF;;stInputCell.param = 0x10;
            lastLParam = LParam;
            curTaskState = 'A';
            break;
         case 0x09:
            stInputCell.OP = CMTerm2View::typeDF_;stInputCell.param = 0x10;
            lastLParam = LParam;
            curTaskState = 'A';
            break;
         case 0x0a:
            strOp = _T("(ED)");strParam = "";lastLParam = LParam;curTaskState = 'A'; break;
         case 0x0b:
            stInputCell.OP = CMTerm2View::typeTM;stInputCell.param = 0x10;
            lastLParam = LParam;
            curTaskState = 'B';
            break;
         case 0x10:
            stInputCell.bpp = true;
            stInputCell.bpn = false;
            break;
         case 0x11:
            stInputCell.bpp = false;
            stInputCell.bpn = true;
            break;
         case 0x12:
            stInputCell.bpp = false;
            stInputCell.bpn = false;
            break;
         case 0x13:
            switch (lastLParam)
            {
            case 0x03:
            case 0x06:
            case 0x07:
            case 0x15:
            case 0x17:
            case 0x16:
            case 0x18:
            case 0x20:
            case 0x21:
            case 0x22:
               stInputCell.OP = CMTerm2View::typeNOT;
               clickCounterNot = 0;
               curTaskState = 'A';
            default:
               break;
            }
            switch (lastLParam)
            {
            case 0x01:
               stInputCell.OP = CMTerm2View::typeNC;break;
            case 0x02:
               stInputCell.OP = CMTerm2View::typeNC;
               stInputCell.bLeftLineUp = true;
               stInputCell.brightLineUp = true;
               break;
            default:
               break;
            }
            lastLParam = LParam;
            stInputCell.bnot = true;
            break;
         case 0x14:
            stInputCell.bnot = false;
            break;
         case 0x15:
            stInputCell.bDouble = true;
            stInputCell.bDouble1 = false;
            stInputCell.bFloat = false;
            stInputCell.bFloat1 = false;
            stInputCell.param = 0x10;lastLParam = LParam;curTaskState = 'B';
            break;
         case 0x17:
            stInputCell.bDouble = false;
            stInputCell.bDouble1 = true;
            stInputCell.bFloat = false;
            stInputCell.bFloat1 = false;
            stInputCell.param = 0x10;lastLParam = LParam;curTaskState = 'B';
            break;
         case 0x16:
            stInputCell.bDouble = false;
            stInputCell.bDouble1 = false;
            stInputCell.bFloat = true;
            stInputCell.bFloat1 = false;
            lastLParam = LParam;stInputCell.param = 0x10;curTaskState = 'B';
            break;
         case 0x18:
            stInputCell.bDouble = false;
            stInputCell.bDouble1 = false;
            stInputCell.bFloat = false;
            stInputCell.bFloat1 = true;
            lastLParam = LParam;stInputCell.param = 0x10;curTaskState = 'B';
            break;
         default:
            break;
         }
      }
      else if (HParam == 0x2)
      {
         switch (LParam)
         {
         case 1:
            stInputCell.param = KLCoilTypeX;curTaskState = 'C'; break;
         case 2:
            stInputCell.param = KLCoilTypeY;curTaskState = 'C'; break;
         case 3:
            stInputCell.param = KLCoilTypeR;curTaskState = 'C'; break;
         case 4:
            stInputCell.param = KLCoilTypeLR; curTaskState = 'C';break;
         case 5:
            strParam = _T(" P");curTaskState = 'C'; break;
         case 6:
            stInputCell.param = KLCoilTypeT; curTaskState = 'C';break;
         case 7:
            stInputCell.param = KLCoilTypeC;curTaskState = 'C'; break;
         case 8:
            strParam = _T(" E");curTaskState = 'C'; break;
         case 9:
            stInputCell.param = OP_TMX;curTaskState = 'C'; break;
         case 0x0a:
            stInputCell.param = OP_TMY;curTaskState = 'C'; break;
         case 0x0b:
            stInputCell.param = OP_TMR;curTaskState = 'C'; break;
         case 0x0c:
            stInputCell.param = OP_TML;curTaskState = 'C'; break;
         case 0x0d:
            if ((lastLParam == 0x03) || (lastLParam == 0x06) || (lastLParam == 0x07) || (lastLParam == 0x08) || (lastLParam == 0x09))
            {
               stInputCell.OP = CMTerm2View::typeNO;
               stInputCell.bnot = false;
               stInputCell.bpp = false;
               stInputCell.bpn = false;
               clickCounter = 0;
               clickCounterNot = 0;
               clickCounterDF = 0;
               clickCounterD = 0;
               clickCounterF = 0;
            }
            lastLParam = 0x20;
            stInputCell.bcmpEq = true;
            if (lastCMP != LParam)
            {
               clickCounterCMP++;
            }
            else
            {
               clickCounterCMP = 1;
               stInputCell.bcmpGt = false;
               stInputCell.bcmpLt = false;
            }
            if (clickCounterCMP > 2)
            {
               clickCounterCMP = 1;
               stInputCell.bcmpGt = false;
               stInputCell.bcmpLt = false;
            }
            lastCMP = LParam;
            curTaskState = 'B'; break;
         case 0x0e:
            if ((lastLParam == 0x03) || (lastLParam == 0x06) || (lastLParam == 0x07) || (lastLParam == 0x08) || (lastLParam == 0x09))
            {
               stInputCell.OP = CMTerm2View::typeNO;
               stInputCell.bnot = false;
               stInputCell.bpp = false;
               stInputCell.bpn = false;
               clickCounter = 0;
               clickCounterNot = 0;
               clickCounterDF = 0;
               clickCounterD = 0;
               clickCounterF = 0;
            }
            lastLParam = 0x21;
            stInputCell.bcmpGt = true;
            if (lastCMP != LParam)
            {
               clickCounterCMP = 1;
               clickCounterCMP++;
            }
            else
            {
               stInputCell.bcmpEq = false;
               stInputCell.bcmpLt = false;
            }
            if (clickCounterCMP > 2)
            {
               clickCounterCMP = 1;
               stInputCell.bcmpEq = false;
               stInputCell.bcmpLt = false;
            }
            lastCMP = LParam;
            curTaskState = 'B'; break;
         case 0x0f:
            if ((lastLParam == 0x03) || (lastLParam == 0x06) || (lastLParam == 0x07) || (lastLParam == 0x08) || (lastLParam == 0x09))
            {
               stInputCell.OP = CMTerm2View::typeNO;
               stInputCell.bnot = false;
               stInputCell.bpp = false;
               stInputCell.bpn = false;
               clickCounter = 0;
               clickCounterNot = 0;
               clickCounterDF = 0;
               clickCounterD = 0;
               clickCounterF = 0;
            }
            lastLParam = 0x22;
            stInputCell.bcmpLt = true;
            if (lastCMP!= LParam)
            {
               clickCounterCMP++;
            }
            else
            {
               clickCounterCMP = 1;
               stInputCell.bcmpEq = false;
               stInputCell.bcmpGt = false;
            }
            if (clickCounterCMP > 2)
            {
               clickCounterCMP = 1;
               stInputCell.bcmpEq = false;
               stInputCell.bcmpGt = false;
            }
            lastCMP = LParam;
            curTaskState = 'B'; break;
         default:
            break;
         }
      }
      else if (HParam == 0x3)
      {
         switch (LParam)
         {
         case 0:
            strNumTemp = _T("0");curTaskState = 'D'; break;
         case 1:
            strNumTemp = _T("1");curTaskState = 'D'; break;
         case 2:
            strNumTemp = _T("2");curTaskState = 'D'; break;
         case 3:
            strNumTemp = _T("3"); curTaskState = 'D';break;
         case 4:
            strNumTemp = _T("4");curTaskState = 'D'; break;
         case 5:
            strNumTemp = _T("5");curTaskState = 'D'; break;
         case 6:
            strNumTemp = _T("6"); curTaskState = 'D';break;
         case 7:
            strNumTemp = _T("7");curTaskState = 'D'; break;
         case 8:
            strNumTemp = _T("8");curTaskState = 'D'; break;
         case 9:
            strNumTemp = _T("9");curTaskState = 'D'; break;
         case 0x0A:
            if ((stInputCell.param == KLCoilTypeT) || (stInputCell.param == KLCoilTypeC))
               ;                        //state not change
            else
            {
               strNumTemp = _T("A");curTaskState = 'D';
            }
             break;
         case 0x0B:
            if ((stInputCell.param == KLCoilTypeT) || (stInputCell.param == KLCoilTypeC))
               ;
            else
            {
               strNumTemp = _T("B");curTaskState = 'D';
            }
            break;
         case 0x0C:
            if ((stInputCell.param == KLCoilTypeT) || (stInputCell.param == KLCoilTypeC))
               ;
            else
            {
               strNumTemp = _T("C"); curTaskState = 'D';
            }
            break;
         case 0x0D:
            if ((stInputCell.param == KLCoilTypeT) || (stInputCell.param == KLCoilTypeC))
               ;
            else
            {
               strNumTemp = _T("D");curTaskState = 'D';
            }
            break;
         case 0x0E:
            if ((stInputCell.param == KLCoilTypeT) || (stInputCell.param == KLCoilTypeC))
               ;
            else
            {
               strNumTemp = _T("E");curTaskState = 'D';
            }
             break;
         case 0x0F:
               if ((stInputCell.param == KLCoilTypeT) || (stInputCell.param == KLCoilTypeC))
                  ;
               else
               {
                  strNumTemp = _T("F");curTaskState = 'D';
               }
             break;
         default:
            break;
         }
         if (stInputCell.num.GetLength() < 4)
         {
            stInputCell.num.Append(strNumTemp);
         }
         else
         {
            stInputCell.num = stInputCell.num.Right(stInputCell.num.GetLength() - 1);
            stInputCell.num.Append(strNumTemp);
         }
      }
      break;
   case 'D':
      if (HParam == 0x1)                      //operator 1
      {
         stInputCell.bnot = false;
         stInputCell.bpp = false;
         stInputCell.bpn = false;
         stInputCell.bcmpEq = false;
         stInputCell.bcmpLt = false;
         stInputCell.bcmpGt = false;
         stInputCell.bDouble = false;
         stInputCell.bDouble1 = false;
         stInputCell.bFloat = false;
         stInputCell.bFloat1 = false;
         stInputCell.bLeftLineUp = false;
         stInputCell.brightLineUp = false;
         if ((LParam >= 0x01) && (LParam <= 0x0f))
         {
            stInputCell.num.Empty();
            if ((LParam == 0x08) || (LParam == 0x09))
            {
               clickCounter = 0;
               clickCounterNot = 0;
               clickCounterCMP = 0;
               clickCounterD = 0;
               clickCounterF = 0;
            }
            else
            {
               if (lastLParam != LParam)
               {
                  clickCounter = 0;
                  clickCounterNot = 0;
                  clickCounterDF = 0;
                  clickCounterCMP = 0;
                  clickCounterD = 0;
                  clickCounterF = 0;
               }
            }
         }
         if ((lastLParam == 0x14) && ((LParam == 0x10) || (LParam == 0x11) || (LParam == 0x12)))  //from not to updown
         {
            clickCounter = 1;
            clickCounterNot = 0;
            clickCounterDF = 0;
            clickCounterCMP = 0;
            clickCounterD = 0;
            clickCounterF = 0;
         }
         if ((lastLParam == 0x10) && ((LParam == 0x13) || (LParam == 0x14)))    //from up to not
         {
            clickCounter = 0;
            clickCounterNot = 1;
            clickCounterDF = 0;
            clickCounterCMP = 0;
            clickCounterD = 0;
            clickCounterF = 0;
         }
         if ((lastLParam == 0x11) && ((LParam == 0x13) || (LParam == 0x14)))    //from down to not
         {
            clickCounter = 0;
            clickCounterNot = 1;
            clickCounterDF = 0;
            clickCounterCMP = 0;
            clickCounterD = 0;
            clickCounterF = 0;
         }
         if ((lastLParam == 0x13) && ((LParam == 0x10) || (LParam == 0x11) || (LParam == 0x12)))  //not
         {
            clickCounter = 0;
            clickCounterNot = 0;
            clickCounterDF = 0;
            clickCounterCMP = 0;
            clickCounterD = 0;
            clickCounterF = 0;
         }
         if ((lastLParam == 0x10) && ((LParam == 0x13) || (LParam == 0x14)))    //updown
         {
            clickCounter = 0;
            clickCounterNot = 0;
            clickCounterDF = 0;
            clickCounterCMP = 0;
            clickCounterD = 0;
            clickCounterF = 0;
         }
         if ((lastLParam == 0x11) && ((LParam == 0x13) || (LParam == 0x14)))    //updown
         {
            clickCounter = 0;
            clickCounterNot = 0;
            clickCounterDF = 0;
            clickCounterCMP = 0;
            clickCounterD = 0;
            clickCounterF = 0;
         }
         if ((lastLParam == 0x15) && ((LParam == 0x16) || (LParam == 0x18)))
         {
            clickCounter = 0;
            clickCounterNot = 0;
            clickCounterDF = 0;
            clickCounterCMP = 0;
            clickCounterD = 0;
            clickCounterF = 1;
         }
         if ((lastLParam == 0x17) && ((LParam == 0x16) || (LParam == 0x18)))
         {
            clickCounter = 0;
            clickCounterNot = 0;
            clickCounterDF = 0;
            clickCounterCMP = 0;
            clickCounterD = 0;
            clickCounterF = 1;
         }
         if ((lastLParam == 0x16) && ((LParam == 0x15) || (LParam == 0x17)))
         {
            clickCounter = 0;
            clickCounterNot = 0;
            clickCounterDF = 0;
            clickCounterCMP = 0;
            clickCounterD = 1;
            clickCounterF = 0;
         }
         if ((lastLParam == 0x18) && ((LParam == 0x15) || (LParam == 0x17)))
         {
            clickCounter = 0;
            clickCounterNot = 0;
            clickCounterDF = 0;
            clickCounterCMP = 0;
            clickCounterD = 1;
            clickCounterF = 0;
         }
         switch (LParam)
         {
         case 0x01:
            stInputCell.OP = CMTerm2View::typeNO; stInputCell.param = 0x10;      //0x10 define para null
            lastLParam = LParam;
            curTaskState = 'B';
            break;
         case 0x02:
            stInputCell.OP = CMTerm2View::typeNO; stInputCell.param = 0x10;
            stInputCell.bLeftLineUp = true;
            stInputCell.brightLineUp = true;
            lastLParam = LParam;
            curTaskState = 'B';
            break;
         case 0x03:
            stInputCell.OP = CMTerm2View::typeOUT; stInputCell.param = 0x10;
            lastLParam = LParam;
            curTaskState = 'B';
            break;
            /*case 4:
               strOp = _T("(MC)");strParam = "";lastLParam = LParam;curTaskState = 'C'; break;
            case 5:
               strOp = _T("(MCE)");strParam = "";lastLParam = LParam;curTaskState = 'C'; break;*/
         case 0x06:
            stInputCell.OP = CMTerm2View::typeSET; stInputCell.param = 0x10; ;lastLParam = LParam;curTaskState = 'B'; break;
         case 0x07:
            stInputCell.OP = CMTerm2View::typeRESET; stInputCell.param = 0x10; ;lastLParam = LParam;curTaskState = 'B'; break;
         case 0x08:
            stInputCell.OP = CMTerm2View::typeDF;stInputCell.param = 0x10;
            lastLParam = LParam;
            curTaskState = 'A';
            break;
         case 0x09:
            stInputCell.OP = CMTerm2View::typeDF_;stInputCell.param = 0x10;
            lastLParam = LParam;
            curTaskState = 'A';
            break;
         case 0x0a:
            strOp = _T("(ED)");strParam = "";lastLParam = LParam;curTaskState = 'A'; break;
         case 0x0b:
            stInputCell.OP = CMTerm2View::typeTM;stInputCell.param = 0x10;
            lastLParam = LParam;
            curTaskState = 'B';
            break;
         case 0x10:
            stInputCell.bpp = true;
            stInputCell.bpn = false;
            break;
         case 0x11:
            stInputCell.bpp = false;
            stInputCell.bpn = true;
            break;
         case 0x12:
            stInputCell.bpp = false;
            stInputCell.bpn = false;
            break;
         case 0x13:
            switch (lastLParam)
            {
            case 3:
            case 6:
            case 7:
            case 0x15:
            case 0x17:
            case 0x16:
            case 0x18:
            case 0x20:
            case 0x21:
            case 0x22:
               stInputCell.OP = CMTerm2View::typeNOT;
               clickCounterNot = 0;
               curTaskState = 'A';
            default:
               break;
            }
            switch (lastLParam)
            {
            case 0x01:
               stInputCell.OP = CMTerm2View::typeNC;break;
            case 0x02:
               stInputCell.OP = CMTerm2View::typeNC;
               stInputCell.bLeftLineUp = true;
               stInputCell.brightLineUp = true;
               break;
            default:
               break;
            }
            lastLParam = LParam;
            stInputCell.bnot = true;
            break;
         case 0x14:
            stInputCell.bnot = false;
            break;
         case 0x15:
            stInputCell.bDouble = true;
            stInputCell.bDouble1 = false;
            stInputCell.bFloat = false;
            stInputCell.bFloat1 = false;
            stInputCell.param = 0x10;lastLParam = LParam;curTaskState = 'B';
            break;
         case 0x17:
            stInputCell.bDouble = false;
            stInputCell.bDouble1 = true;
            stInputCell.bFloat = false;
            stInputCell.bFloat1 = false;
            stInputCell.param = 0x10;lastLParam = LParam;curTaskState = 'B';
            break;
         case 0x16:
            stInputCell.bDouble = false;
            stInputCell.bDouble1 = false;
            stInputCell.bFloat = true;
            stInputCell.bFloat1 = false;
            lastLParam = LParam;stInputCell.param = 0x10;curTaskState = 'B';
            break;
         case 0x18:
            stInputCell.bDouble = false;
            stInputCell.bDouble1 = false;
            stInputCell.bFloat = false;
            stInputCell.bFloat1 = true;
            lastLParam = LParam;stInputCell.param = 0x10;curTaskState = 'B';
            break;
         default:
            break;
         }
         if(curTaskState != 'D')
         {
         stInputCell.num.Empty();
          }
      }
      else if (HParam == 0x2)
      {
         switch (LParam)
         {
         case 1:
            stInputCell.param = KLCoilTypeX;curTaskState = 'C'; break;
         case 2:
            stInputCell.param = KLCoilTypeY;curTaskState = 'C'; break;
         case 3:
            stInputCell.param = KLCoilTypeR;curTaskState = 'C'; break;
         case 4:
            stInputCell.param = KLCoilTypeLR; curTaskState = 'C';break;
         case 5:
            strParam = _T(" P");curTaskState = 'C'; break;
         case 6:
            stInputCell.param = KLCoilTypeT; curTaskState = 'C';break;
         case 7:
            stInputCell.param = KLCoilTypeC;curTaskState = 'C'; break;
         case 8:
            strParam = _T(" E");curTaskState = 'C'; break;
         case 9:
            stInputCell.param = OP_TMX;curTaskState = 'C'; break;
         case 0x0a:
            stInputCell.param = OP_TMY;curTaskState = 'C'; break;
         case 0x0b:
            stInputCell.param = OP_TMR;curTaskState = 'C'; break;
         case 0x0c:
            stInputCell.param = OP_TML;curTaskState = 'C'; break;
         case 0x0d:
            if ((lastLParam == 0x03) || (lastLParam == 0x06) || (lastLParam == 0x07) || (lastLParam == 0x08) || (lastLParam == 0x09))
            {
               stInputCell.OP = CMTerm2View::typeNO;
               stInputCell.bnot = false;
               stInputCell.bpp = false;
               stInputCell.bpn = false;
               clickCounter = 0;
               clickCounterNot = 0;
               clickCounterDF = 0;
               clickCounterD = 0;
               clickCounterF = 0;
            }
            lastLParam = 0x20;
            stInputCell.bcmpEq = true;
            if (lastCMP!= LParam)
            {
               clickCounterCMP++;
            }
            else
            {
               clickCounterCMP = 1;
               stInputCell.bcmpGt = false;
               stInputCell.bcmpLt = false;
            }
            if (clickCounterCMP > 2)
            {
               clickCounterCMP = 1;
               stInputCell.bcmpGt = false;
               stInputCell.bcmpLt = false;
            }
            lastCMP = LParam;
            curTaskState = 'B'; break;
         case 0x0e:
            if ((lastLParam == 0x03) || (lastLParam == 0x06) || (lastLParam == 0x07) || (lastLParam == 0x08) || (lastLParam == 0x09))
            {
               stInputCell.OP = CMTerm2View::typeNO;
               stInputCell.bnot = false;
               stInputCell.bpp = false;
               stInputCell.bpn = false;
               clickCounter = 0;
               clickCounterNot = 0;
               clickCounterDF = 0;
               clickCounterD = 0;
               clickCounterF = 0;
            }
            lastLParam = 0x21;
            stInputCell.bcmpGt = true;
            if (lastCMP != LParam)
            {
               clickCounterCMP++;
            }
            else
            {
               clickCounterCMP = 1;
               stInputCell.bcmpEq = false;
               stInputCell.bcmpLt = false;
            }
            if (clickCounterCMP > 2)
            {
               clickCounterCMP = 1;
               stInputCell.bcmpEq = false;
               stInputCell.bcmpLt = false;
            }
            lastCMP = LParam;
            curTaskState = 'B'; break;
         case 0x0f:
            if ((lastLParam == 0x03) || (lastLParam == 0x06) || (lastLParam == 0x07) || (lastLParam == 0x08) || (lastLParam == 0x09))
            {
               stInputCell.OP = CMTerm2View::typeNO;
               stInputCell.bnot = false;
               stInputCell.bpp = false;
               stInputCell.bpn = false;
               clickCounter = 0;
               clickCounterNot = 0;
               clickCounterDF = 0;
               clickCounterD = 0;
               clickCounterF = 0;
            }
            lastLParam = 0x22;
            stInputCell.bcmpLt = true;
            if (lastCMP != LParam)
            {
               clickCounterCMP++;
            }
            else
            {
               clickCounterCMP = 1;
               stInputCell.bcmpEq = false;
               stInputCell.bcmpGt = false;
            }
            if (clickCounterCMP > 2)
            {
               clickCounterCMP = 1;
               stInputCell.bcmpEq = false;
               stInputCell.bcmpGt = false;
            }
            lastCMP = LParam;
            curTaskState = 'B'; break;
         default:
            break;
         }
         if (curTaskState != 'D')
         {
            stInputCell.num.Empty();
         }
      }
      else if (HParam == 0x3)
      {
         switch (LParam)
         {
         case 0:
            strNumTemp = _T("0");curTaskState = 'D'; break;
         case 1:
            strNumTemp = _T("1");curTaskState = 'D'; break;
         case 2:
            strNumTemp = _T("2");curTaskState = 'D'; break;
         case 3:
            strNumTemp = _T("3"); curTaskState = 'D';break;
         case 4:
            strNumTemp = _T("4");curTaskState = 'D'; break;
         case 5:
            strNumTemp = _T("5");curTaskState = 'D'; break;
         case 6:
            strNumTemp = _T("6"); curTaskState = 'D';break;
         case 7:
            strNumTemp = _T("7");curTaskState = 'D'; break;
         case 8:
            strNumTemp = _T("8");curTaskState = 'D'; break;
         case 9:
            strNumTemp = _T("9");curTaskState = 'D'; break;
         case 0x0A:
            if ((stInputCell.param == KLCoilTypeT) || (stInputCell.param == KLCoilTypeC))
               ;                        //state not change
            else
            {
               strNumTemp = _T("A");curTaskState = 'D';
            }
            break;
         case 0x0B:
            if ((stInputCell.param == KLCoilTypeT) || (stInputCell.param == KLCoilTypeC))
               ;
            else
            {
               strNumTemp = _T("B");curTaskState = 'D';
            }
            break;
         case 0x0C:
            if ((stInputCell.param == KLCoilTypeT) || (stInputCell.param == KLCoilTypeC))
               ;
            else
            {
               strNumTemp = _T("C"); curTaskState = 'D';
            }
            break;
         case 0x0D:
            if ((stInputCell.param == KLCoilTypeT) || (stInputCell.param == KLCoilTypeC))
               ;
            else
            {
               strNumTemp = _T("D");curTaskState = 'D';
            }
            break;
         case 0x0E:
            if ((stInputCell.param == KLCoilTypeT) || (stInputCell.param == KLCoilTypeC))
               ;
            else
            {
               strNumTemp = _T("E");curTaskState = 'D';
            }
            break;
         case 0x0F:
            if ((stInputCell.param == KLCoilTypeT) || (stInputCell.param == KLCoilTypeC))
               ;
            else
            {
               strNumTemp = _T("F");curTaskState = 'D';
            }
            break;
         default:
            break;
         }
         if (stInputCell.num.GetLength() < 4)
         {
            stInputCell.num.Append(strNumTemp);
         }
         else
         {
               stInputCell.num = stInputCell.num.Right(stInputCell.num.GetLength() - 1);
               stInputCell.num.Append(strNumTemp);
               for (int i = 0;i < stInputCell.num.GetLength() ;i++)
               {
                  if (stInputCell.num[i] == _T('0'))
                  {
                     ;
                  }
                  else
                  {
                     flag = 1;break;
                  }
               }
               if (flag==0)
               {
                  stInputCell.num.Empty();
                  stInputCell.num.Append(_T("0"));
               }
         }
         int num = stInputCell.num.GetLength();
         for (int i = 0; i < num; i++)
         {
            int len1 = stInputCell.num.GetLength();
            if (len1 > 1 && stInputCell.num[0] == _T('0')) stInputCell.num = stInputCell.num.Right(stInputCell.num.GetLength() - 1);
         }
      }
      break;
   }    //end switch
   if (HParam==0x14)
   {
      bool editEndFlag = false;                                              //********************************************************************************************************
      switch (stInputCell.OP)
      {
      case CMTerm2View::typeNO:
      case CMTerm2View::typeNC:
      case CMTerm2View::typeOUT:
      case CMTerm2View::typeSET:
      case CMTerm2View::typeRESET:
      case CMTerm2View::typeTM:
         if (curTaskState == 'D')
         {
            editEndFlag = true;
         }
      case CMTerm2View::typeDF:
      case CMTerm2View::typeDF_:
         if (curTaskState == 'A')
         {
            editEndFlag = true;
         }
      default:
         break;
      }
      if ((stInputCell.bcmpEq)||(stInputCell.bcmpGt)|| (stInputCell.bcmpLt))
      {
         editEndFlag = true;
      }
      if (editEndFlag)
      {
         CMainFrame * p1 = (CMainFrame *)AfxGetMainWnd();
         p1->GetInputCell(stInputCell);
      }
      else
      {
         CMainFrame * p1 = (CMainFrame *)AfxGetMainWnd();
         CString str = _T("无法确定指令输入");
         //p1->m_wndStatusBar.GetStatusBarCtrl().SetBkColor(RGB(255, 0, 0));
         p1->m_wndStatusBar.SetPaneText(0, str);
      }
   }
   display(stInputCell);
   return 0;
}
void CMyDlgBarInputShow::stInit()
{
   stInputCell=
   {
       CMTerm2View::typeNO,
       false,
       false,
       false,
       false,
       false,
       false,
       false,
       false,
       false,
       false,
       false,
       false,
       0x10,
      _T("")
    };
}
int CMyDlgBarInputShow::display(tagInputCell stDisplayCell)
{
   static CString strOp, strParam,strNum;
   static CString str;
   switch (stDisplayCell.OP)
   {
   case CMTerm2View::typeNO:
      if ((stInputCell.bLeftLineUp)&&(stInputCell.brightLineUp))
      {
         strOp = _T("└┤├┘");
      }
      else
      {
         strOp = _T("-| |-");
      }
      break;
   case CMTerm2View::typeNC:
      if ((stInputCell.bLeftLineUp) && (stInputCell.brightLineUp))
      {
         strOp = _T("└┤/├┘");
      }
      else
      {
         strOp = _T("-|/|-");
      }
      break;
   case CMTerm2View::typeOUT:
      strOp = _T("-[ ]");
      break;
   case CMTerm2View::typeSET:
      strOp = _T("-<S>");
      break;
   case CMTerm2View::typeRESET:
      strOp = _T("-<R>");
      break;
   case CMTerm2View::typeDF:
      strOp = _T("(DF)");
      break;
   case CMTerm2View::typeDF_:
      strOp = _T("(DF/)");
      break;
   case CMTerm2View::typeNOT:
      strOp = _T("-/-");
      break;
   case CMTerm2View::typeTM:
      strOp = _T("-[TM]");
      break;
   case CMTerm2View::typeCMP:
      break;
   default:
      break;
   }
   if (stDisplayCell.bnot)
   {
      switch (stDisplayCell.OP)
      {
      case CMTerm2View::typeNO:
         if ((stInputCell.bLeftLineUp) && (stInputCell.brightLineUp))
         {
            strOp = _T("└┤/├┘");
         }
         else
         {
            strOp = _T("-|/|-");
         }
         break;
      case CMTerm2View::typeOUT:
         strOp = _T("-/-");
         break;
      case CMTerm2View::typeSET:
         strOp = _T("-/-");
         break;
      case CMTerm2View::typeRESET:
         strOp = _T("-/-");
         break;
      case CMTerm2View::typeDF:
         strOp = _T("(DF/)");
         break;
      case CMTerm2View::typeDF_:
         strOp = _T("(DF)");
         break;
      case CMTerm2View::typeNOT:
         strOp = _T("-/-");
         break;
      case CMTerm2View::typeTM:
         strOp = _T("-/-");
         break;
      default:
         break;
      }
   }
   if (stDisplayCell.bpp)
   {
      switch (stDisplayCell.OP)
      {
      case CMTerm2View::typeNO:
         if ((stInputCell.bLeftLineUp) && (stInputCell.brightLineUp))
         {
            strOp = _T("└┤↑├┘");
         }
         else
         {
            strOp = _T("-|↑|-");
         }
         break;
      case CMTerm2View::typeOUT:
         strOp = _T("-[↑]");
         break;
      default:
         break;
      }
   }
   if (stDisplayCell.bpn)
   {
      switch (stDisplayCell.OP)
      {
      case CMTerm2View::typeNO:
         if ((stInputCell.bLeftLineUp) && (stInputCell.brightLineUp))
         {
            strOp = _T("└┤↓├┘");
         }
         else
         {
            strOp = _T("-|↓|-");
         }
         break;
      case CMTerm2View::typeOUT:
         strOp = _T("-[↓]");
         break;
      default:
         break;
      }
   }
   if (stDisplayCell.bDouble)
   {
      switch (stDisplayCell.OP)
      {
      case CMTerm2View::typeNO:
         if ((stInputCell.bLeftLineUp) && (stInputCell.brightLineUp))
         {
            strOp = _T("└┤├┘D");
         }
         else
         {
            strOp = _T("-| |-D");
         }
         break;
      case CMTerm2View::typeOUT:
         strOp = _T("-| |-D");
         break;
      case CMTerm2View::typeSET:
         strOp = _T("-| |-D");
         break;
      case CMTerm2View::typeRESET:
         strOp = _T("-| |-D");
         break;
      case CMTerm2View::typeDF:
         strOp = _T("-| |-D");
         break;
      case CMTerm2View::typeDF_:
         strOp = _T("-| |-D");
         break;
      case CMTerm2View::typeNOT:
         strOp = _T("-| |-D");
         break;
      case CMTerm2View::typeTM:
         strOp = _T("-| |-D");
         break;
      default:
         break;
      }
   }
   if (stDisplayCell.bDouble1)
   {
      switch (stDisplayCell.OP)
      {
      case CMTerm2View::typeNO:
         if ((stInputCell.bLeftLineUp) && (stInputCell.brightLineUp))
         {
            strOp = _T("└┤├┘");
         }
         else
         {
            strOp = _T("-| |-");
         }
         break;
      case CMTerm2View::typeOUT:
         strOp = _T("-| |-");
         break;
      case CMTerm2View::typeSET:
         strOp = _T("-| |-");
         break;
      case CMTerm2View::typeRESET:
         strOp = _T("-| |-");
         break;
      case CMTerm2View::typeDF:
         strOp = _T("-| |-");
         break;
      case CMTerm2View::typeDF_:
         strOp = _T("-| |-");
         break;
      case CMTerm2View::typeNOT:
         strOp = _T("-| |-");
         break;
      case CMTerm2View::typeTM:
         strOp = _T("-| |-");
         break;
      default:
         break;
      }
   }
   if (stDisplayCell.bFloat)
   {
      switch (stDisplayCell.OP)
      {
      case CMTerm2View::typeNO:
         if ((stInputCell.bLeftLineUp) && (stInputCell.brightLineUp))
         {
            strOp = _T("└┤├┘F");
         }
         else
         {
            strOp = _T("-| |-F");
         }
         break;
      case CMTerm2View::typeOUT:
         strOp = _T("-| |-F");
         break;
      case CMTerm2View::typeSET:
         strOp = _T("-| |-F");
         break;
      case CMTerm2View::typeRESET:
         strOp = _T("-| |-F");
         break;
      case CMTerm2View::typeDF:
         strOp = _T("-| |-F");
         break;
      case CMTerm2View::typeDF_:
         strOp = _T("-| |-F");
         break;
      case CMTerm2View::typeNOT:
         strOp = _T("-| |-F");
         break;
      case CMTerm2View::typeTM:
         strOp = _T("-| |-F");
         break;
      default:
         break;
      }
   }
   if (stDisplayCell.bFloat1)
   {
      switch (stDisplayCell.OP)
      {
      case CMTerm2View::typeNO:
         if ((stInputCell.bLeftLineUp) && (stInputCell.brightLineUp))
         {
            strOp = _T("└┤├┘");
         }
         else
         {
            strOp = _T("-| |-");
         }
      case CMTerm2View::typeOUT:
         strOp = _T("-| |-");
         break;
      case CMTerm2View::typeSET:
         strOp = _T("-| |-");
         break;
      case CMTerm2View::typeRESET:
         strOp = _T("-| |-");
         break;
      case CMTerm2View::typeDF:
         strOp = _T("-| |-");
         break;
      case CMTerm2View::typeDF_:
         strOp = _T("-| |-");
         break;
      case CMTerm2View::typeNOT:
         strOp = _T("-| |-");
         break;
      case CMTerm2View::typeTM:
         strOp = _T("-| |-");
         break;
      default:
         break;
      }
   }
   switch (stDisplayCell.param)
   {
   case KLCoilTypeX:
      strParam = _T("X");
      break;
   case KLCoilTypeY:
      strParam = _T("Y");
      break;
   case KLCoilTypeR:
      strParam = _T("R");
      break;
   case KLCoilTypeLR:
      strParam = _T("L");
      break;
   case KLCoilTypeT:
      strParam = _T("T");
      break;
   case KLCoilTypeC:
      strParam = _T("C");
      break;
   case OP_TMX:
      if (strOp == _T("-[TM]"))
         strOp = "";
      strParam = _T("-[TMX]");
      break;
   case OP_TMY:
      if (strOp == _T("-[TM]"))
         strOp = "";
      strParam = _T("-[TMY]");
      break;
   case OP_TMR:
      if (strOp == _T("-[TM]"))
         strOp = "";
      strParam = _T("-[TMR]");
      break;
   case OP_TML:
      if (strOp == _T("-[TM]"))
         strOp = "";
      strParam = _T("-[TML]");
      break;
   default:
      strParam = " ";
      break;
   }
   if ((stInputCell.bcmpEq)&&(!stInputCell.bcmpLt)&&(!stInputCell.bcmpGt))
   {
      strParam = "=";
   }
   if ((!stInputCell.bcmpEq) && (stInputCell.bcmpLt) && (!stInputCell.bcmpGt))
   {
      strParam = "<";
   }
   if ((!stInputCell.bcmpEq) && (!stInputCell.bcmpLt) && (stInputCell.bcmpGt))
   {
      strParam = ">";
   }
   if ((stInputCell.bcmpEq) && (stInputCell.bcmpLt))
   {
      strParam = "<=";
   }
   if ((stInputCell.bcmpEq) && (stInputCell.bcmpGt))
   {
      strParam = ">=";
   }
   if ((stInputCell.bcmpLt) && (stInputCell.bcmpGt))
   {
      strParam = "<>";
   }
   strNum = stDisplayCell.num;
   str = strOp + _T(" ") + strParam + " " + strNum;
   SetDlgItemText(IDC_EDIT_INPUT, str);
   return 0;
}
int CMyDlgBarInputShow::SetDisplay1(int inputInfo)
{
   // TODO: 在此处添加实现代码.
/*
   static int clickCounter = 0;
   static int clickCounterDF = 0;
   static int clickCounterNot = 0;
   static char curTaskState = 'A';
   static int lastLParam = 0;
   static CString str, strStoreB, strStoreC, strNum;
   static CString strOp, strParam;
   CString s1,strNumTemp;
   int para=0;
   int HParam, LParam;
   s1.Format(_T("is this window %d"), IsWindow(m_hWnd));
   SysLog(s1);
//   ChangeState(inputInfo>>16, lastTaskState, curTaskState);
   if (inputInfo == 0x00010008)
   {
      clickCounterDF++;
      if (clickCounterDF == 1)                     //DF  redefine key value
      {
         inputInfo = 0x00010008;
      }
      else if (clickCounterDF == 2)
      {
         inputInfo = 0x00010009;
         clickCounterDF = 0;
      }
   }
   if (inputInfo==0x00010010)
   {
      clickCounter++;
      if (clickCounter == 1)  //updown  redefine key value
      {
         inputInfo = 0x00010010;
      }
      else if (clickCounter == 2)
      {
         inputInfo = 0x00010011;
      }
      else if (clickCounter == 3)
      {
         inputInfo = 0x00010012;
         clickCounter = 0;
      }
   }
   if (inputInfo == 0x00010013)
   {
      clickCounterNot++;
      if (clickCounterNot == 1)                     //NOT  redefine key value
      {
         inputInfo = 0x00010013;
      }
      else if (clickCounterNot == 2)
      {
         inputInfo = 0x00010014;
         clickCounterNot = 0;
      }
   }
   HParam = inputInfo >> 16;
   LParam = inputInfo & 0xffff;
   switch (curTaskState)
   {
   case 'A':
      if (HParam == 0x1)                      //operator 1
      {
         switch (LParam)
         {
         case 1:
            strOp = _T("-| |-"); strParam = "";
            if (lastLParam != LParam)
            {
               clickCounter = 0;
               clickCounterNot = 0;
            }
            lastLParam = LParam;
            curTaskState = 'B';
            break;
         case 2:
            strOp = _T("└┤├┘");strParam = "";
            if (lastLParam != LParam)
            {
               clickCounter = 0;
               clickCounterNot = 0;
            }
            lastLParam = LParam;
            curTaskState = 'B';
            break;
         case 3:
            strOp = _T("-[ ]");strParam = "";
            if (lastLParam != LParam)
            {
               clickCounter = 0;
               clickCounterNot = 0;
            }
            lastLParam = LParam;
            curTaskState = 'B';
            break;
         case 4:
            strOp = _T("(MC)");strParam = "";lastLParam = LParam;curTaskState = 'C'; break;
         case 5:
            strOp = _T("(MCE)");strParam = "";lastLParam = LParam;curTaskState = 'C'; break;
         case 6:
            strOp = _T("-<S>");strParam = "";lastLParam = LParam;curTaskState = 'B'; break;
         case 7:
            strOp = _T("-<R>");strParam = "";lastLParam = LParam;curTaskState = 'B'; break;
         case 8:
            strOp = _T("(DF)");strParam = "";
            if (lastLParam != LParam)
            {
               clickCounterNot = 0;
            }
            lastLParam = LParam;
            curTaskState = 'A';
            break;
         case 9:
            strOp = _T("(DF/)");strParam = "";
            if (lastLParam != LParam)
            {
               clickCounterNot = 0;
            }
            lastLParam = LParam;
            curTaskState = 'A';
            break;
         case 0x0a:
            strOp = _T("(ED)");strParam = "";lastLParam = LParam;curTaskState = 'A'; break;
         case 0x0b:
            strOp = _T("-[TMX]-"); strParam = "";lastLParam = LParam;curTaskState = 'C'; break;
         case 0x0c:
            strOp = _T("-[TMY]-"); strParam = "";lastLParam = LParam;curTaskState = 'C'; break;
         case 0x0d:
            strOp = _T("-[TMR]-"); strParam = "";lastLParam = LParam;curTaskState = 'C'; break;
         case 0x0e:
            strOp = _T("-[TML]-"); strParam = "";lastLParam = LParam;curTaskState = 'C'; break;
         case 0x0f:
            strOp = _T("-[CT]-"); strParam = "";lastLParam = LParam;curTaskState = 'C'; break;
         case 0x10:
            switch (lastLParam)
            {
            case 1:
               strOp = _T("-|↑|-");strParam = "";curTaskState = 'B'; break;
            case 2:
               strOp = _T("└┤↑├┘");strParam = "";curTaskState = 'B'; break;
            case 3:
               strOp = _T("-[↑]"); strParam = "";curTaskState = 'B';break;
            default:
               break;
            }
            break;
         case 0x11:
            switch (lastLParam)
            {
            case 1:
               strOp = _T("-|↓|-");strParam = "";curTaskState = 'B'; break;
            case 2:
               strOp = _T("└┤↓├┘");strParam = "";curTaskState = 'B'; break;
            case 3:
               strOp = _T("-[↓]");strParam = "";curTaskState = 'B'; break;
            default:
               break;
            }
            break;
         case 0x12:
            switch (lastLParam)
            {
            case 1:
               strOp = _T("-| |-");strParam = "";curTaskState = 'B'; break;
            case 2:
               strOp = _T("└┤├┘");strParam = "";curTaskState = 'B'; break;
            case 3:
               strOp = _T("-[ ]");strParam = "";curTaskState = 'B'; break;
            default:
               break;
            }
            break;
         case 0x13:
            switch (lastLParam)
            {
            case 1:
               strOp = _T("-|/|-");strParam = "";curTaskState = 'B'; break;
            case 2:
               strOp = _T("└┤/├┘");strParam = "";curTaskState = 'B'; break;
            case 8:
               strOp = _T("(DF/)");strParam = "";curTaskState = 'A'; break;
            case 9:
               strOp = _T("(DF)");strParam = "";curTaskState = 'A'; break;
            case 3:
            case 4:
            case 5:
            case 6:
            case 7:
            case 0xa:
            case 0xb:
            case 0xc:
            case 0xd:
            case 0xe:
            case 0xf:
               strOp = _T("- / -");strParam = "";curTaskState = 'A';break;
            default:
               break;
            }
            break;
         case 0x14:
            switch (lastLParam)
            {
            case 1:
               strOp = _T("-| |-");strParam = "";curTaskState = 'B'; break;
            case 2:
               strOp = _T("└┤├┘"); strParam = "";curTaskState = 'B';break;
            case 8:
               strOp = _T("(DF)");strParam = "";curTaskState = 'A'; break;
            case 9:
               strOp = _T("(DF/)");strParam = "";curTaskState = 'A'; break;
            case 3:
            case 4:
            case 5:
            case 6:
            case 7:
            case 0xa:
            case 0xb:
            case 0xc:
            case 0xd:
            case 0xe:
            case 0xf:
               strOp = _T("- / -");strParam = "";curTaskState = 'A';break;
            default:
               break;
            }
            break;
         default:
            break;
         }
      }
      str = strOp;
      break;
   case 'B':
      str = strOp;
      if (HParam == 0x1)                      //operator 1
      {
         switch (LParam)
         {
         case 1:
            strOp = _T("-| |-"); strParam = "";
            if (lastLParam != LParam)
            {
               clickCounter = 0;
               clickCounterNot = 0;
            }
            lastLParam = LParam;
            curTaskState = 'B';
            break;
         case 2:
            strOp = _T("└┤├┘");strParam = "";
            if (lastLParam != LParam)
            {
               clickCounter = 0;
               clickCounterNot = 0;
            }
            lastLParam = LParam;
            curTaskState = 'B';
            break;
         case 3:
            strOp = _T("-[ ]");strParam = "";
            if (lastLParam != LParam)
            {
               clickCounter = 0;
               clickCounterNot = 0;
            }
            lastLParam = LParam;
            curTaskState = 'B';
            break;
         case 4:
            strOp = _T("(MC)");strParam = "";lastLParam = LParam;curTaskState = 'C'; break;
         case 5:
            strOp = _T("(MCE)");strParam = "";lastLParam = LParam;curTaskState = 'C'; break;
         case 6:
            strOp = _T("-<S>");strParam = "";lastLParam = LParam;curTaskState = 'B'; break;
         case 7:
            strOp = _T("-<R>");strParam = "";lastLParam = LParam;curTaskState = 'B'; break;
         case 8:
            strOp = _T("(DF)");strParam = "";
            if (lastLParam != LParam)
            {
               clickCounterNot = 0;
            }
            lastLParam = LParam;
            curTaskState = 'A';
            break;
         case 9:
            strOp = _T("(DF/)");strParam = "";
            if (lastLParam != LParam)
            {
               clickCounterNot = 0;
            }
            lastLParam = LParam;
            curTaskState = 'A';
            break;
         case 0x0a:
            strOp = _T("(ED)");strParam = "";lastLParam = LParam;curTaskState = 'A'; break;
         case 0x0b:
            strOp = _T("-[TMX]-"); strParam = "";lastLParam = LParam;curTaskState = 'C'; break;
         case 0x0c:
            strOp = _T("-[TMY]-"); strParam = "";lastLParam = LParam;curTaskState = 'C'; break;
         case 0x0d:
            strOp = _T("-[TMR]-"); strParam = "";lastLParam = LParam;curTaskState = 'C'; break;
         case 0x0e:
            strOp = _T("-[TML]-"); strParam = "";lastLParam = LParam;curTaskState = 'C'; break;
         case 0x0f:
            strOp = _T("-[CT]-"); strParam = "";lastLParam = LParam;curTaskState = 'C'; break;
         case 0x10:
            switch (lastLParam)
            {
            case 1:
               strOp = _T("-|↑|-");strParam = "";curTaskState = 'B'; break;
            case 2:
               strOp = _T("└┤↑├┘");strParam = "";curTaskState = 'B'; break;
            case 3:
               strOp = _T("-[↑]"); strParam = "";curTaskState = 'B';break;
            default:
               break;
            }
            break;
         case 0x11:
            switch (lastLParam)
            {
            case 1:
               strOp = _T("-|↓|-");strParam = "";curTaskState = 'B'; break;
            case 2:
               strOp = _T("└┤↓├┘");strParam = "";curTaskState = 'B'; break;
            case 3:
               strOp = _T("-[↓]");strParam = "";curTaskState = 'B'; break;
            default:
               break;
            }
            break;
         case 0x12:
            switch (lastLParam)
            {
            case 1:
               strOp = _T("-| |-");strParam = "";curTaskState = 'B'; break;
            case 2:
               strOp = _T("└┤├┘");strParam = "";curTaskState = 'B'; break;
            case 3:
               strOp = _T("-[ ]");strParam = "";curTaskState = 'B'; break;
            default:
               break;
            }
            break;
         case 0x13:
            switch (lastLParam)
            {
            case 1:
               strOp = _T("-|/|-");strParam = "";curTaskState = 'B'; break;
            case 2:
               strOp = _T("└┤/├┘");strParam = "";curTaskState = 'B'; break;
            case 8:
               strOp = _T("(DF/)");strParam = "";curTaskState = 'A'; break;
            case 9:
               strOp = _T("(DF)");strParam = "";curTaskState = 'A'; break;
            case 3:
            case 4:
            case 5:
            case 6:
            case 7:
            case 0xa:
            case 0xb:
            case 0xc:
            case 0xd:
            case 0xe:
            case 0xf:
               strOp = _T("- / -");strParam = "";curTaskState = 'A';break;
            default:
               break;
            }
            break;
         case 0x14:
            switch (lastLParam)
            {
            case 1:
               strOp = _T("-| |-");strParam = "";curTaskState = 'B'; break;
            case 2:
               strOp = _T("└┤├┘"); strParam = "";curTaskState = 'B';break;
            case 8:
               strOp = _T("(DF)");strParam = "";curTaskState = 'A'; break;
            case 9:
               strOp = _T("(DF/)");strParam = "";curTaskState = 'A'; break;
            case 3:
            case 4:
            case 5:
            case 6:
            case 7:
            case 0xa:
            case 0xb:
            case 0xc:
            case 0xd:
            case 0xe:
            case 0xf:
               strOp = _T("- / -");strParam = "";curTaskState = 'A';break;
            default:
               break;
            }
            break;
         default:
            break;
         }
      }
      else if (HParam == 0x2)
      {
         switch (LParam)
         {
         case 1:
            strParam =_T(" X");curTaskState = 'C'; break;
         case 2:
            strParam = _T(" Y");curTaskState = 'C'; break;
         case 3:
            strParam = _T(" R");curTaskState = 'C'; break;
         case 4:
            strParam = _T(" L"); curTaskState = 'C';break;
         case 5:
            strParam = _T(" P");curTaskState = 'C'; break;
         case 6:
            strParam = _T(" T"); curTaskState = 'C';break;
         case 7:
            strParam = _T(" C");curTaskState = 'C'; break;
         case 8:
            strParam = _T(" E");curTaskState = 'C'; break;
         default:
            break;
         }
      }
      str = strOp + _T(" ") + strParam;
      break;
   case 'C':
   //   str = strOp + _T(" ") + strParam;
      if (HParam == 0x1)                      //operator 1
      {
         switch (LParam)
         {
         case 1:
            strOp = _T("-| |-"); strParam = "";
            if (lastLParam != LParam)
            {
               clickCounter = 0;
               clickCounterNot = 0;
            }
            lastLParam = LParam;
            curTaskState = 'B';
            break;
         case 2:
            strOp = _T("└┤├┘");strParam = "";
            if (lastLParam != LParam)
            {
               clickCounter = 0;
               clickCounterNot = 0;
            }
            lastLParam = LParam;
            curTaskState = 'B';
            break;
         case 3:
            strOp = _T("-[ ]");strParam = "";
            if (lastLParam != LParam)
            {
               clickCounter = 0;
               clickCounterNot = 0;
            }
            lastLParam = LParam;
            curTaskState = 'B';
            break;
         case 4:
            strOp = _T("(MC)");strParam = "";lastLParam = LParam;curTaskState = 'C'; break;
         case 5:
            strOp = _T("(MCE)");strParam = "";lastLParam = LParam;curTaskState = 'C'; break;
         case 6:
            strOp = _T("-<S>");strParam = "";lastLParam = LParam;curTaskState = 'B'; break;
         case 7:
            strOp = _T("-<R>");strParam = "";lastLParam = LParam;curTaskState = 'B'; break;
         case 8:
            strOp = _T("(DF)");strParam = "";
            if (lastLParam != LParam)
            {
               clickCounterNot = 0;
            }
            lastLParam = LParam;
            curTaskState = 'A';
            break;
         case 9:
            strOp = _T("(DF/)");strParam = "";
            if (lastLParam != LParam)
            {
               clickCounterNot = 0;
            }
            lastLParam = LParam;
            curTaskState = 'A';
            break;
         case 0x0a:
            strOp = _T("(ED)");strParam = "";lastLParam = LParam;curTaskState = 'A'; break;
         case 0x0b:
            strOp = _T("-[TMX]-"); strParam = "";lastLParam = LParam;curTaskState = 'C'; break;
         case 0x0c:
            strOp = _T("-[TMY]-"); strParam = "";lastLParam = LParam;curTaskState = 'C'; break;
         case 0x0d:
            strOp = _T("-[TMR]-"); strParam = "";lastLParam = LParam;curTaskState = 'C'; break;
         case 0x0e:
            strOp = _T("-[TML]-"); strParam = "";lastLParam = LParam;curTaskState = 'C'; break;
         case 0x0f:
            strOp = _T("-[CT]-"); strParam = "";lastLParam = LParam;curTaskState = 'C'; break;
         case 0x10:
            switch (lastLParam)
            {
            case 1:
               strOp = _T("-|↑|-");strParam = "";curTaskState = 'B'; break;
            case 2:
               strOp = _T("└┤↑├┘");strParam = "";curTaskState = 'B'; break;
            case 3:
               strOp = _T("-[↑]"); strParam = "";curTaskState = 'B';break;
            default:
               break;
            }
            break;
         case 0x11:
            switch (lastLParam)
            {
            case 1:
               strOp = _T("-|↓|-");strParam = "";curTaskState = 'B'; break;
            case 2:
               strOp = _T("└┤↓├┘");strParam = "";curTaskState = 'B'; break;
            case 3:
               strOp = _T("-[↓]");strParam = "";curTaskState = 'B'; break;
            default:
               break;
            }
            break;
         case 0x12:
            switch (lastLParam)
            {
            case 1:
               strOp = _T("-| |-");strParam = "";curTaskState = 'B'; break;
            case 2:
               strOp = _T("└┤├┘");strParam = "";curTaskState = 'B'; break;
            case 3:
               strOp = _T("-[ ]");strParam = "";curTaskState = 'B'; break;
            default:
               break;
            }
            break;
         case 0x13:
            switch (lastLParam)
            {
            case 1:
               strOp = _T("-|/|-");strParam = "";curTaskState = 'B'; break;
            case 2:
               strOp = _T("└┤/├┘");strParam = "";curTaskState = 'B'; break;
            case 8:
               strOp = _T("(DF/)");strParam = "";curTaskState = 'A'; break;
            case 9:
               strOp = _T("(DF)");strParam = "";curTaskState = 'A'; break;
            case 3:
            case 4:
            case 5:
            case 6:
            case 7:
            case 0xa:
            case 0xb:
            case 0xc:
            case 0xd:
            case 0xe:
            case 0xf:
               strOp = _T("- / -");strParam = "";curTaskState = 'A';break;
            default:
               break;
            }
            break;
         case 0x14:
            switch (lastLParam)
            {
            case 1:
               strOp = _T("-| |-");strParam = "";curTaskState = 'B'; break;
            case 2:
               strOp = _T("└┤├┘"); strParam = "";curTaskState = 'B';break;
            case 8:
               strOp = _T("(DF)");strParam = "";curTaskState = 'A'; break;
            case 9:
               strOp = _T("(DF/)");strParam = "";curTaskState = 'A'; break;
            case 3:
            case 4:
            case 5:
            case 6:
            case 7:
            case 0xa:
            case 0xb:
            case 0xc:
            case 0xd:
            case 0xe:
            case 0xf:
               strOp = _T("- / -");strParam = "";curTaskState = 'A';break;
            default:
               break;
            }
            break;
         default:
            break;
         }
      }
      else if (HParam == 0x2)
      {
         switch (LParam)
         {
         case 1:
            strParam = _T(" X");curTaskState = 'C'; break;
         case 2:
            strParam = _T(" Y");curTaskState = 'C'; break;
         case 3:
            strParam = _T(" R");curTaskState = 'C'; break;
         case 4:
            strParam = _T(" L"); curTaskState = 'C';break;
         case 5:
            strParam = _T(" P");curTaskState = 'C'; break;
         case 6:
            strParam = _T(" T"); curTaskState = 'C';break;
         case 7:
            strParam = _T(" C");curTaskState = 'C'; break;
         case 8:
            strParam = _T(" E");curTaskState = 'C'; break;
         default:
            break;
         }
      }
      else if (HParam == 0x3)
      {
         switch (LParam)
         {
         case 0:
            strNumTemp = _T("0");curTaskState = 'D'; break;
         case 1:
            strNumTemp = _T("1");curTaskState = 'D'; break;
         case 2:
            strNumTemp = _T("2");curTaskState = 'D'; break;
         case 3:
            strNumTemp = _T("3"); curTaskState = 'D';break;
         case 4:
            strNumTemp = _T("4");curTaskState = 'D'; break;
         case 5:
            strNumTemp = _T("5");curTaskState = 'D'; break;
         case 6:
            strNumTemp = _T("6"); curTaskState = 'D';break;
         case 7:
            strNumTemp = _T("7");curTaskState = 'D'; break;
         case 8:
            strNumTemp = _T("8");curTaskState = 'D'; break;
         case 9:
            strNumTemp = _T("9");curTaskState = 'D'; break;
         case 0x0A:
            strNumTemp = _T("A");curTaskState = 'D'; break;
         case 0x0B:
            strNumTemp = _T("B");curTaskState = 'D'; break;
         case 0x0C:
            strNumTemp = _T("C"); curTaskState = 'D';break;
         case 0x0D:
            strNumTemp = _T("D");curTaskState = 'D'; break;
         case 0x0E:
            strNumTemp = _T("E");curTaskState = 'D'; break;
         case 0x0F:
            strNumTemp = _T("F");curTaskState = 'D'; break;
         default:
            break;
         }
         if (strNum.GetLength() < 4)
         {
            strNum.Append(strNumTemp);
         }
         else
         {
            strNum = strNum.Right(strNum.GetLength() - 1);
            strNum.Append(strNumTemp);
         }
      }
      str = strOp + _T(" ") + strParam+ " " + strNum;
      break;
   case 'D':
      if (HParam == 0x1)                      //operator 1
      {
         switch (LParam)
         {
         case 1:
            strOp = _T("-| |-"); strParam = "";
            if (lastLParam != LParam)
            {
               clickCounter = 0;
               clickCounterNot = 0;
            }
            lastLParam = LParam;
            curTaskState = 'B';
            break;
         case 2:
            strOp = _T("└┤├┘");strParam = "";
            if (lastLParam != LParam)
            {
               clickCounter = 0;
               clickCounterNot = 0;
            }
            lastLParam = LParam;
            curTaskState = 'B';
            break;
         case 3:
            strOp = _T("-[ ]");strParam = "";
            if (lastLParam != LParam)
            {
               clickCounter = 0;
               clickCounterNot = 0;
            }
            lastLParam = LParam;
            curTaskState = 'B';
            break;
         case 4:
            strOp = _T("(MC)");strParam = "";lastLParam = LParam;curTaskState = 'C'; break;
         case 5:
            strOp = _T("(MCE)");strParam = "";lastLParam = LParam;curTaskState = 'C'; break;
         case 6:
            strOp = _T("-<S>");strParam = "";lastLParam = LParam;curTaskState = 'B'; break;
         case 7:
            strOp = _T("-<R>");strParam = "";lastLParam = LParam;curTaskState = 'B'; break;
         case 8:
            strOp = _T("(DF)");strParam = "";
            if (lastLParam != LParam)
            {
               clickCounterNot = 0;
            }
            lastLParam = LParam;
            curTaskState = 'A';
            break;
         case 9:
            strOp = _T("(DF/)");strParam = "";
            if (lastLParam != LParam)
            {
               clickCounterNot = 0;
            }
            lastLParam = LParam;
            curTaskState = 'A';
            break;
         case 0x0a:
            strOp = _T("(ED)");strParam = "";lastLParam = LParam;curTaskState = 'A'; break;
         case 0x0b:
            strOp = _T("-[TMX]-"); strParam = "";lastLParam = LParam;curTaskState = 'C'; break;
         case 0x0c:
            strOp = _T("-[TMY]-"); strParam = "";lastLParam = LParam;curTaskState = 'C'; break;
         case 0x0d:
            strOp = _T("-[TMR]-"); strParam = "";lastLParam = LParam;curTaskState = 'C'; break;
         case 0x0e:
            strOp = _T("-[TML]-"); strParam = "";lastLParam = LParam;curTaskState = 'C'; break;
         case 0x0f:
            strOp = _T("-[CT]-"); strParam = "";lastLParam = LParam;curTaskState = 'C'; break;
         case 0x10:
            switch (lastLParam)
            {
            case 1:
               strOp = _T("-|↑|-");strParam = "";curTaskState = 'B'; break;
            case 2:
               strOp = _T("└┤↑├┘");strParam = "";curTaskState = 'B'; break;
            case 3:
               strOp = _T("-[↑]"); strParam = "";curTaskState = 'B';break;
            default:
               break;
            }
            break;
         case 0x11:
            switch (lastLParam)
            {
            case 1:
               strOp = _T("-|↓|-");strParam = "";curTaskState = 'B'; break;
            case 2:
               strOp = _T("└┤↓├┘");strParam = "";curTaskState = 'B'; break;
            case 3:
               strOp = _T("-[↓]");strParam = "";curTaskState = 'B'; break;
            default:
               break;
            }
            break;
         case 0x12:
            switch (lastLParam)
            {
            case 1:
               strOp = _T("-| |-");strParam = "";curTaskState = 'B'; break;
            case 2:
               strOp = _T("└┤├┘");strParam = "";curTaskState = 'B'; break;
            case 3:
               strOp = _T("-[ ]");strParam = "";curTaskState = 'B'; break;
            default:
               break;
            }
            break;
         case 0x13:
            switch (lastLParam)
            {
            case 1:
               strOp = _T("-|/|-");strParam = "";curTaskState = 'B'; break;
            case 2:
               strOp = _T("└┤/├┘");strParam = "";curTaskState = 'B'; break;
            case 8:
               strOp = _T("(DF/)");strParam = "";curTaskState = 'A'; break;
            case 9:
               strOp = _T("(DF)");strParam = "";curTaskState = 'A'; break;
            case 3:
            case 4:
            case 5:
            case 6:
            case 7:
            case 0xa:
            case 0xb:
            case 0xc:
            case 0xd:
            case 0xe:
            case 0xf:
               strOp = _T("- / -");strParam = "";curTaskState = 'A';break;
            default:
               break;
            }
            break;
         case 0x14:
            switch (lastLParam)
            {
            case 1:
               strOp = _T("-| |-");strParam = "";curTaskState = 'B'; break;
            case 2:
               strOp = _T("└┤├┘"); strParam = "";curTaskState = 'B';break;
            case 8:
               strOp = _T("(DF)");strParam = "";curTaskState = 'A'; break;
            case 9:
               strOp = _T("(DF/)");strParam = "";curTaskState = 'A'; break;
            case 3:
            case 4:
            case 5:
            case 6:
            case 7:
            case 0xa:
            case 0xb:
            case 0xc:
            case 0xd:
            case 0xe:
            case 0xf:
               strOp = _T("- / -");strParam = "";curTaskState = 'A';break;
            default:
               break;
            }
            break;
         default:
            break;
         }
         strNum.Empty();
      }
      else if (HParam == 0x2)
      {
         switch (LParam)
         {
         case 1:
            strParam = _T(" X");curTaskState = 'C'; break;
         case 2:
            strParam = _T(" Y");curTaskState = 'C'; break;
         case 3:
            strParam = _T(" R");curTaskState = 'C'; break;
         case 4:
            strParam = _T(" L"); curTaskState = 'C';break;
         case 5:
            strParam = _T(" P");curTaskState = 'C'; break;
         case 6:
            strParam = _T(" T"); curTaskState = 'C';break;
         case 7:
            strParam = _T(" C");curTaskState = 'C'; break;
         case 8:
            strParam = _T(" E");curTaskState = 'C'; break;
         default:
            break;
         }
         strNum.Empty();
      }
      else if (HParam == 0x3)
      {
         switch (LParam)
         {
         case 0:
            strNumTemp = _T("0");curTaskState = 'D'; break;
         case 1:
            strNumTemp = _T("1");curTaskState = 'D'; break;
         case 2:
            strNumTemp = _T("2");curTaskState = 'D'; break;
         case 3:
            strNumTemp = _T("3"); curTaskState = 'D';break;
         case 4:
            strNumTemp = _T("4");curTaskState = 'D'; break;
         case 5:
            strNumTemp = _T("5");curTaskState = 'D'; break;
         case 6:
            strNumTemp = _T("6"); curTaskState = 'D';break;
         case 7:
            strNumTemp = _T("7");curTaskState = 'D'; break;
         case 8:
            strNumTemp = _T("8");curTaskState = 'D'; break;
         case 9:
            strNumTemp = _T("9");curTaskState = 'D'; break;
         case 0x0A:
            strNumTemp = _T("A");curTaskState = 'D'; break;
         case 0x0B:
            strNumTemp = _T("B");curTaskState = 'D'; break;
         case 0x0C:
            strNumTemp = _T("C"); curTaskState = 'D';break;
         case 0x0D:
            strNumTemp = _T("D");curTaskState = 'D'; break;
         case 0x0E:
            strNumTemp = _T("E");curTaskState = 'D'; break;
         case 0x0F:
            strNumTemp = _T("F");curTaskState = 'D'; break;
         default:
            break;
         }
         if (strNum.GetLength() < 4)
         {
            strNum.Append(strNumTemp);
         }
         else
         {
            strNum = strNum.Right(strNum.GetLength() - 1);
            strNum.Append(strNumTemp);
         }
      }
      else if (HParam == 0x14)
      {
         strParam = "";
         strNum = "";
         curTaskState = 'A';
         strNum.Empty();
      }
      str = strOp + _T(" ") + strParam + " " + strNum;
      break;
   }
   SetDlgItemText(IDC_EDIT_INPUT,str);
//   m_edit_input.SetWindowText(str); */
   return 0;
}