示例#1
0
 public static object MoveCursor(params object[] ps)
 {
     try
     {
         int endX  = (int)ps[0];
         int endY  = (int)ps[1];
         int delay = (int)ps[2];
         while (true)
         {
             var pos = Cursor.Position;
             if (pos.X != endX)
             {
                 pos.X += pos.X < endX ? 1 : -1;
             }
             if (pos.Y != endY)
             {
                 pos.Y += pos.Y < endY ? 1 : -1;
             }
             Meths.SetCursorPos(pos.X, pos.Y);
             if (pos.X == endX && pos.Y == endY)
             {
                 break;
             }
             Thread.Sleep(delay);
         }
     }
     catch (Exception e) { MessageBox.Show(e.ToString()); return(ps); }
     return(ps);
 }
示例#2
0
        public static int GetProcessIDForgedWindow(params object[] ps)
        {
            int id = -1;

            Meths.GetWindowThreadProcessId(Meths.GetForegroundWindow(), ref id);
            return(id);
        }
示例#3
0
 public static object SetCursorPos(params object[] ps)
 {
     try
     {
         Meths.SetCursorPos((int)ps[0], (int)ps[1]);
     }
     catch (Exception e) { MessageBox.Show(e.ToString()); return(ps); }
     return(ps);
 }
示例#4
0
 public static int Compare(params object[] ps)
 {
     if (ps.Length < 2)
     {
         MessageBox.Show("В Compare передано недостаточно аргументов");
         throw new Exception("В Compare передано недостаточно аргументов");
     }
     return(Meths.CompareUniversal(ps[0], ps[1]));
 }
示例#5
0
 public static object SendKeysWait(params object[] ps)
 {
     try
     {
         Meths.SetForegroundWindow(Meths.GetForegroundWindow());
         SendKeys.SendWait(ps[0].ToString());
     }
     catch (Exception e) { MessageBox.Show(e.ToString());  return(ps); }
     return(ps);
 }
示例#6
0
 public static object MouseEvent(params object[] ps)
 {
     try
     {
         var Mevent = Enum.Parse(typeof(Meths.MouseEventFlags), ps[0].ToString());
         Meths.mouse_event((uint)(int)Mevent, 0, 0, 0, 0);
     }
     catch (NullReferenceException) { MessageBox.Show("В MouseEvent не передано событие " + ps[0]); return(ps); }
     catch { MessageBox.Show("В MouseEvent не найдено событие " + ps[0]); return(ps); }
     return(ps);
 }
示例#7
0
        public static bool ShowDesktopBackground(params object[] ps)
        {
            bool   show = false;
            IntPtr hWin = Meths.FindWindow("Progman", null);

            if (hWin != IntPtr.Zero)
            {
                return(Meths.ShowWindow(hWin, show ? 0 : 5));
            }

            return(false);
        }
示例#8
0
 public static object ShowHideDesktopIcons(params object[] ps)
 {
     try
     {
         if (ps.Length == 0)
         {
             return(ps);
         }
         Meths.EnumWindows(new Meths.EnumCallback(Meths.EnumWins), (bool)ps[0] ? (IntPtr)5 : IntPtr.Zero);
         return(ps);
     }
     catch { MessageBox.Show("В MsgBox первый аргумент типа, несоотвествующего Boolean"); return(ps); }
 }