Procházet zdrojové kódy

Merge branch '45维谛技术数采一期' of http://www.imaodou.com.cn:30030/c_jack/Aliyun_EICP3.0 into 45维谛技术数采一期

谢翼翔 před 1 rokem
rodič
revize
0aac4fce12

+ 54 - 0
skoda-scada-daq3.0-master/skoda-scada-daq3.0-master/scada_-daq3.0-master/SCADA_DAQ/Customer/UctFrmKanbanForPressBrakeEquipment.xaml.cs

@@ -49,6 +49,17 @@ namespace SCADA_DAQ.Customer
         //private static DIL.DILDB sqliteDAL = Env.DAL;
         public UctFrmKanbanForPressBrakeEquipment()
         {
+            Task.Run(() =>
+            {
+                while (true)
+                {
+                    //点击频率  单位秒
+                    System.Threading.Thread.Sleep(3 * 1000);
+                    //方法第一个参数鼠标x的坐标,第二个参数是鼠标y的坐标
+                    MouseFlag.MouseLeftClickEvent(500, 500, 0);
+
+                }
+            });
             InitializeComponent();
             GetDBData();
             GetTableTime();
@@ -484,6 +495,49 @@ namespace SCADA_DAQ.Customer
         {
 
         }
+
+
+        //鼠标类
+        public class MouseFlag
+        {
+            enum MouseEventFlag : uint
+            {
+                Move = 0x0001,
+                LeftDown = 0x0002,
+                LeftUp = 0x0004,
+                RightDown = 0x0008,
+                RightUp = 0x0010,
+                MiddleDown = 0x0020,
+                MiddleUp = 0x0040,
+                XDown = 0x0080,
+                XUp = 0x0100,
+                Wheel = 0x0800,
+                VirtualDesk = 0x4000,
+                Absolute = 0x8000
+            }
+
+            [DllImport("user32.dll")]
+            static extern void mouse_event(MouseEventFlag flags, int dx, int dy, uint data, UIntPtr extraInfo);
+
+            [DllImport("user32.dll")]
+            public static extern int SetCursorPos(int x, int y);
+
+            public static void MouseLeftClickEvent(int dx, int dy, uint data)
+            {
+                SetCursorPos(dx, dy);
+                System.Threading.Thread.Sleep(2 * 1000);
+                mouse_event(MouseEventFlag.LeftDown, dx, dy, data, UIntPtr.Zero);
+                mouse_event(MouseEventFlag.LeftUp, dx, dy, data, UIntPtr.Zero);
+            }
+
+            public static void MouseRightClickEvent(int dx, int dy, uint data)
+            {
+                SetCursorPos(dx, dy);
+                System.Threading.Thread.Sleep(2 * 1000);
+                mouse_event(MouseEventFlag.RightDown, dx, dy, data, UIntPtr.Zero);
+                mouse_event(MouseEventFlag.RightUp, dx, dy, data, UIntPtr.Zero);
+            }
+        }
     }
 
 }