コード例 #1
0
        public int[] GetWindowSize(String windowName)
        {
            Generic generic = new Generic(this);

            try
            {
                return(generic.GetWindowSize(windowName));
            }
            finally
            {
                generic = null;
            }
        }
コード例 #2
0
ファイル: Core.cs プロジェクト: boomuuh/cobra-winldtp
 public int[] GetWindowSize(String windowName)
 {
     Generic generic = new Generic(this);
     try
     {
         return generic.GetWindowSize(windowName);
     }
     finally
     {
         generic = null;
     }
 }
コード例 #3
0
ファイル: Mouse.cs プロジェクト: nagappan/cobra
 public int SimulateMouseMove(int source_x, int source_y, int dest_x, int dest_y, double delay = 0.0)
 {
     int[] size;
     Generic generic = new Generic(utils);
     try
     {
         size = generic.GetWindowSize("paneProgramManager");
     }
     finally
     {
         generic = null;
     }
     if (source_x < size[0] || source_y < size[1] ||
         dest_x > size[2] || dest_y > size[3] ||
         source_x > size[2] || source_y > size[3] ||
         dest_x < size[0] || dest_y < size[1])
         return 0;
     bool x_flag = true; // Iterated x ?
     bool y_flag = true; // Iterated y ?
     while (true)
     {
         if (x_flag)
         {
             if (source_x > dest_x)
             {
                 // If source X greather than dest X
                 // then move -1 pixel
                 source_x -= 1;
             }
             else if (source_x < dest_x)
             {
                 // If source X less than dest X
                 // then move +1 pixel
                 source_x += 1;
             }
             else
             {
                 // If source X equal to dest X
                 // then don't process X co-ordinate
                 x_flag = false;
             }
         }
         if (y_flag)
         {
             if (source_y > dest_y)
             {
                 // If source Y greather than dest Y
                 // then move -1 pixel
                 source_y -= 1;
             }
             else if (source_y < dest_y)
             {
                 // If source Y less than dest Y
                 // then move +1 pixel
                 source_y += 1;
             }
             else
             {
                 // If source Y equal to dest Y
                 // then don't process Y co-ordinate
                 y_flag = false;
             }
         }
         if (delay != 0.0)
             utils.InternalWait(delay);
         // Start mouse move from source_x, source_y to dest_x, dest_y
         GenerateMouseEvent(source_x, source_y, "abs");
         if (source_x == dest_x && source_y == dest_y)
         {
             // If we have reached the dest_x and dest_y
             // then break the loop
             break;
         }
     }
     return 1;
 }
コード例 #4
0
        public int SimulateMouseMove(int source_x, int source_y, int dest_x, int dest_y, double delay = 0.0)
        {
            int[]   size;
            Generic generic = new Generic(utils);

            try
            {
                size = generic.GetWindowSize("paneProgramManager");
            }
            finally
            {
                generic = null;
            }
            if (source_x < size[0] || source_y <size[1] ||
                                                dest_x> size[2] || dest_y > size[3] ||
                source_x > size[2] || source_y > size[3] ||
                dest_x < size[0] || dest_y < size[1])
            {
                return(0);
            }
            bool x_flag = true; // Iterated x ?
            bool y_flag = true; // Iterated y ?

            while (true)
            {
                if (x_flag)
                {
                    if (source_x > dest_x)
                    {
                        // If source X greather than dest X
                        // then move -1 pixel
                        source_x -= 1;
                    }
                    else if (source_x < dest_x)
                    {
                        // If source X less than dest X
                        // then move +1 pixel
                        source_x += 1;
                    }
                    else
                    {
                        // If source X equal to dest X
                        // then don't process X co-ordinate
                        x_flag = false;
                    }
                }
                if (y_flag)
                {
                    if (source_y > dest_y)
                    {
                        // If source Y greather than dest Y
                        // then move -1 pixel
                        source_y -= 1;
                    }
                    else if (source_y < dest_y)
                    {
                        // If source Y less than dest Y
                        // then move +1 pixel
                        source_y += 1;
                    }
                    else
                    {
                        // If source Y equal to dest Y
                        // then don't process Y co-ordinate
                        y_flag = false;
                    }
                }
                if (delay != 0.0)
                {
                    utils.InternalWait(delay);
                }
                // Start mouse move from source_x, source_y to dest_x, dest_y
                GenerateMouseEvent(source_x, source_y, "abs");
                if (source_x == dest_x && source_y == dest_y)
                {
                    // If we have reached the dest_x and dest_y
                    // then break the loop
                    break;
                }
            }
            return(1);
        }