天猫 刷红包

来源:互联网 发布:ai软件使用教程 编辑:程序博客网 时间:2024/05/13 15:28

今天刚做的,很简单 直接看代码:我的电脑是1280*800的,不知道在别的电脑上有没问题

因为刷的时候会弹出各种原因的对话框,都是找到那个关闭按钮坐标,模拟点击关闭的

有兴趣自己耍耍,不要搞别的!

using System;using System.Runtime.InteropServices;using System.Windows;using System.Windows.Input;using System.Windows.Threading;namespace ControlMouseOver{    /// <summary>    /// MainWindow.xaml 的交互逻辑    /// </summary>    public partial class MainWindow : Window    {        [DllImport("user32.dll", CharSet = CharSet.Auto)]        public static extern bool GetCursorPos(ref  POINT pt);        [DllImport("user32.dll")]        public static extern int SetCursorPos(int x, int y);        [DllImport("user32")]        private static extern int mouse_event(int dwFlags, int dx, int dy, int cButtons, int dwExtraInfo);        const int MOUSEEVENTF_LEFTDOWN = 0x2;        const int MOUSEEVENTF_LEFTUP = 0x4;        const int MOUSEEVENTF_MIDDLEDOWN = 0x20;        const int MOUSEEVENTF_MIDDLEUP = 0x40;        const int MOUSEEVENTF_MOVE = 0x1;        const int MOUSEEVENTF_ABSOLUTE = 0x8000;        const int MOUSEEVENTF_RIGHTDOWN = 0x8;        const int MOUSEEVENTF_RIGHTUP = 0x10;        DispatcherTimer timer = new DispatcherTimer();        DispatcherTimer timer2 = new DispatcherTimer();        DispatcherTimer time3 = new DispatcherTimer();               public MainWindow()        {            InitializeComponent();            timer.Tick += timer_Tick;            timer.Interval = new TimeSpan(0, 0, 0, 0, 1);            timer2.Tick += timer2_Tick;            timer2.Interval = new TimeSpan(0, 0, 0, 0, 1);            time3.Interval = new TimeSpan(0, 0, 0, 3);            time3.Tick += time3_Tick;             }        void time3_Tick(object sender, EventArgs e)        {                     POINT p = new POINT();            p.x = 838;            p.y = 361;            SetCursorPos(p.x, p.y);            mouse_event(MOUSEEVENTF_LEFTDOWN, p.x, p.y, 0, 0);            mouse_event(MOUSEEVENTF_LEFTUP, p.x, p.y, 0, 0);        }        void timer2_Tick(object sender, EventArgs e)        {            POINT p = new POINT();            mouse_event(MOUSEEVENTF_MOVE, p.x + 20, p.y, 0, 0);            temp += 10;            if (temp == 210)            {                timer2.Stop();                timer.Start();                temp = 0;            }        }        int temp = 0;        void timer_Tick(object sender, System.EventArgs e)        {            POINT p = new POINT();            mouse_event(MOUSEEVENTF_MOVE, p.x - 20, p.y, 0, 0);            temp += 10;            if (temp == 210)            {                timer.Stop();                temp = 0;                timer2.Start();            }        }        private void Button_Click(object sender, RoutedEventArgs e)        {            timer.Start();            time3.Start();            POINT p = new POINT();            p.x = 645;            p.y = 311;            SetCursorPos(p.x, p.y);            mouse_event(MOUSEEVENTF_LEFTDOWN, p.x, p.y, 0, 0);            mouse_event(MOUSEEVENTF_LEFTUP, p.x, p.y, 0, 0);        }        private void Window_KeyDown(object sender, System.Windows.Input.KeyEventArgs e)        {            if ( e.Key == Key.Escape)            {                Application.Current.Shutdown();            }        }        //private void Button_Click_1(object sender, RoutedEventArgs e)        //{        //   // POINT p = new POINT();        //   // //p.x = 888;        //   // //p.y = 50;        //   //// SetCursorPos(p.x, p.y);        //   // GetCursorPos(ref p);        //   // //mouse_event(MOUSEEVENTF_LEFTDOWN, p.x, p.y, 0, 0);        //   // //mouse_event(MOUSEEVENTF_LEFTUP, p.x, p.y, 0, 0);        //   // MessageBox.Show(p.x.ToString() + " " + p.y.ToString());        //}          }  [StructLayout(LayoutKind.Sequential)]    public struct POINT    {        public int x, y;    }}

 


<script type="text/javascript"><!--google_ad_client = "ca-pub-1944176156128447";/* cnblogs 首页横幅 */google_ad_slot = "5419468456";google_ad_width = 728;google_ad_height = 90;//--></script><script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>