Exemplo n.º 1
0
        protected void EnterText()  //This logic assumes there is only one edit box in the Win and the NEXT button is the same as previous (true for TC)
        // GetDlgCtrl handle of edit box enter text Exception is Password which has 2 edit boxes separated by tab processing
        {
            int wCtrLstIndex = tcWin.winCtrlList.FindIndex(delegate(TCWin.WinCtrls w) { return(w.cntrlClass.Equals("Edit")); });

            Win32.SendMessage(tcWin.winCtrlList[wCtrLstIndex].hCtrl, (int)win32Message.EM_SETSEL, (IntPtr)0, (IntPtr)(-1)); //selects all existing text
            char[] values = winAction[r].variableText.ToCharArray();
            foreach (char c in values)
            {
                if (c != '\t')
                {
                    int scanCode = VKeytoScanCodeCls.Lookup(c);
                    int LParam   = Win32.MakeLParam(0x0001, scanCode);
                    int t        = Win32.PostMessage(tcWin.winCtrlList[wCtrLstIndex].hCtrl, (int)win32Message.WM_CHAR, (IntPtr)Convert.ToInt32(c), (IntPtr)LParam);
                }
                else
                {
                    wCtrLstIndex += 1; // this is password setup with confirm box immediately after password entry box in window control list
                }
            }
            // Next section allows multiple buttons (including radio buttons) to be clicked
            string[] buttonStrings = winAction[r].captionText.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
            foreach (var item in buttonStrings)
            {// special processing to convert Next button to enter key to whole window caused by vol loc screen change in TC7.0 (never save history checkbox went from an s to an n same as next
                if (string.Compare(item, "Next", true) == 0)
                {
                    Win32.PostMessage(tcWin.hWndHandle, (int)win32Message.WM_KEYDOWN, (IntPtr)'\r', (IntPtr)0x1C0001);
                }
                else
                {
                    NextButton(item, string.Empty);
                }
            }
        }
Exemplo n.º 2
0
        void NextButton(string caption, string sendLetter)
        {
            int wCtrLstIndex = 0;
            int ch           = 0;

            wCtrLstIndex = tcWin.winCtrlList.FindIndex(delegate(TCWin.WinCtrls w) { return(w.cntrlClass.Equals("Button") & w.caption.Contains(caption)); });
            if (nFlag == 1)                                               //diagnostic for arg out of range on xp
            {
                Log.WritWTime("NextButton = " + wCtrLstIndex.ToString()); //diagnostic for arg out of range on xp
            }
            if (sendLetter == string.Empty)
            {
                if (nFlag == 1)                                                                //diagnostic for arg out of range on xp
                {
                    Log.WritWTime("caption = " + tcWin.winCtrlList[wCtrLstIndex].caption);     //Ampersand marks letter used to operate button
                }
                int posAmp = tcWin.winCtrlList[wCtrLstIndex].caption.IndexOf('&') + 1;         //Ampersand marks letter used to operate button
                if (nFlag == 1)                                                                //diagnostic for arg out of range on xp
                {
                    Log.WritWTime("poAmp = " + posAmp.ToString());                             //Ampersand marks letter used to operate button
                }
                ch = Char.Parse(tcWin.winCtrlList[wCtrLstIndex].caption.Substring(posAmp, 1)); //  Convert character after & in the string to int32
            }
            else
            {
                ch = Char.Parse(sendLetter);
            }
            int scanCode = VKeytoScanCodeCls.Lookup(Char.Parse(tcWin.winCtrlList[wCtrLstIndex].caption.Substring(1, 1)));
            int LParam   = Win32.MakeLParam(0x0001, scanCode);

            Win32.PostMessage(tcWin.winCtrlList[wCtrLstIndex].hCtrl, (int)win32Message.WM_CHAR, (IntPtr)ch, (IntPtr)LParam);
            //Log.WritWTime("hctrl = " + tcWin.hWndHandle.ToString() + tcWin.winCtrlList[wCtrLstIndex].cntrlClass.ToString() + " " + tcWin.winCtrlList[wCtrLstIndex].caption + " char ch = " + ch);
        }
Exemplo n.º 3
0
        protected void SpecialKey() //Assumes single character
        {
            int  wCtrLstIdx = tcWin.winCtrlList.FindIndex(delegate(TCWin.WinCtrls w) { return(w.cntrlClass.Equals("Button") & w.caption.Contains(winAction[r].captionText)); });
            int  ch         = Char.Parse(winAction[r].variableText);
            char c1         = char.Parse(winAction[r].variableText);
            int  scanCode1  = VKeytoScanCodeCls.Lookup(c1);
            int  LParam1    = Win32.MakeLParam(0x0001, scanCode1);

            Win32.SetFocus(tcWin.winCtrlList[wCtrLstIdx].hCtrl);
            Win32.PostMessage(tcWin.winCtrlList[wCtrLstIdx].hCtrl, (int)win32Message.WM_KEYDOWN, (IntPtr)ch, (IntPtr)LParam1);
        }