Beispiel #1
0
 public bool Up(IntPtr hWnd, bool foreground)
 {
     switch (ShiftType)
     {
     case Messaging.ShiftType.NONE:
         if (foreground)
         {
             if (!Messaging.ForegroundKeyUp(hWnd, this))
             {
                 _buttonCounter++;
                 if (_buttonCounter == 2)
                 {
                     _buttonCounter = 0;
                     return(false);
                 }
                 Up(hWnd, foreground);
             }
         }
         else
         {
             if (!Messaging.SendMessageUp(hWnd, this, true))
             {
                 _buttonCounter++;
                 if (_buttonCounter == 2)
                 {
                     _buttonCounter = 0;
                     return(false);
                 }
                 Up(hWnd, foreground);
             }
         }
         return(true);
     }
     return(true);
 }
Beispiel #2
0
        public bool Up(IntPtr hWnd, bool foreground)
        {
            if (this.ShiftType != MessagingApi.ShiftType.NONE)
            {
                return(false);
            }

            int counter = 0;

            while (counter < RetryCount)
            {
                if (foreground)
                {
                    if (Messaging.ForegroundKeyUp(hWnd, this))
                    {
                        return(true);
                    }
                }
                else
                {
                    if (Messaging.SendMessageKeyUp(hWnd, this, true))
                    {
                        return(true);
                    }
                }

                counter++;
            }

            return(false);
        }