Ejemplo n.º 1
0
 public mpButton(string ButtonName, mpKeyArray mpKeyArray, int Repeat, mpTime RepeatInterval)
 {
     this.ButtonName = ButtonName;
     this.mpKeyArray = mpKeyArray;
     this.Repeat = Repeat;
     this.RepeatInterval = RepeatInterval;
 }
Ejemplo n.º 2
0
        private void SendKeys(IntPtr hWnd, mpKeyArray mpKeyArray)
        {
            int RepeatCount = 0;

            while (Repeat == 0 || RepeatCount < Repeat)
            {
                if (this.KeepWindowMinimize)
                {
                    SendWindowMinimize(hWnd);
                }

                mpKey[] mpKeys = mpKeyArray.TranslatedKeyArray;

                foreach (mpKey mpKey in mpKeys)
                {
                    if (mpKey.Type == mpKeyType.K)
                    {
                        SendKey(hWnd, mpKey);
                    }
                    else if (mpKey.Type == mpKeyType.MM || mpKey.Type == mpKeyType.MC)
                    {
                        SendMouse(mpKey);
                    }
                    else if (mpKey.Type == mpKeyType.D)
                    {
                        mpTimer.Sleep(mpKey.DelayInterval);
                    }
                }

                if (Repeat != 0)
                    RepeatCount++;

                if (Repeat != 1)
                    mpTimer.Sleep(RepeatInterval);
            }

            OnSendKeyArrayFinished(this, null);
        }