Пример #1
0
        public static void StopAndUpload()
        {
            IntPtr hwnd = HwndUtil.FindWindow("WTWindow", null);

            if (hwnd != IntPtr.Zero)
            {
                hwnd = HwndUtil.FindWindowEx(hwnd, IntPtr.Zero, "SysTabControl32", "");
                hwnd = HwndUtil.FindWindowEx(hwnd, IntPtr.Zero, "Button", "");
                hwnd = HwndUtil.FindWindowEx(hwnd, IntPtr.Zero, "Button", "结束投票");
                HwndUtil.clickHwnd(hwnd);
                int    s      = 0;
                IntPtr hwndEx = IntPtr.Zero;
                do
                {
                    Thread.Sleep(500);
                    hwnd   = HwndUtil.FindWindow("WTWindow", null);
                    hwndEx = HwndUtil.FindWindow("#32770", "信息:");
                    if (s % 10 == 0 && hwnd != IntPtr.Zero)
                    {
                        IntPtr hwnd0 = HwndUtil.FindWindowEx(hwnd, IntPtr.Zero, "SysTabControl32", "");
                        hwnd0 = HwndUtil.FindWindowEx(hwnd0, IntPtr.Zero, "Button", "");
                        hwnd0 = HwndUtil.FindWindowEx(hwnd0, IntPtr.Zero, "Button", "结束投票");
                        HwndUtil.clickHwnd(hwnd0);
                    }
                    if (hwndEx != IntPtr.Zero)
                    {
                        HwndUtil.closeHwnd(hwndEx);
                        s = 90;
                    }
                    s++;
                } while (hwnd != IntPtr.Zero && s < 90);
            }
        }
Пример #2
0
        private static void ErrReconnect()
        {
            IntPtr adslErr = HwndUtil.FindWindow("#32770", "连接到 " + ConfigCore.AdslName + " 时出错");

            if (adslErr != IntPtr.Zero)
            {
                IntPtr hwndEx = HwndUtil.FindWindowEx(adslErr, IntPtr.Zero, "Button", null);
                string title  = HwndUtil.GetControlText(hwndEx);
                if (title.IndexOf("重拨") != -1)
                {
                    LogCore.Write($"{ConfigCore.AdslName}拨号出错,重播");
                    HwndUtil.clickHwnd(hwndEx);
                }
            }
        }
Пример #3
0
        public static void CloseException()
        {
            IntPtr adslExcp = HwndUtil.FindWindow("#32770", "网络连接");

            if (adslExcp != IntPtr.Zero)
            {
                IntPtr hwndEx = HwndUtil.FindWindowEx(adslExcp, IntPtr.Zero, "Button", null);
                if (hwndEx != IntPtr.Zero)
                {
                    string title = HwndUtil.GetControlText(hwndEx);
                    if (title.IndexOf("重拨") != -1 || title == "确定")
                    {
                        HwndUtil.clickHwnd(hwndEx);
                    }
                }
            }

            ErrReconnect();
        }
Пример #4
0
 //处理句柄操作线程
 private static void clickHwndByThread()
 {
     HwndUtil.clickHwnd(inHwnd);
 }
Пример #5
0
        //九天启动
        public static void Start()
        {
            TaskCore taskCore = MonitorCore.GetTaskCore();

            taskCore.ProjectName = TaskCore.TASK_VOTE_JIUTIAN;
            IntPtr hwnd = IntPtr.Zero;
            IntPtr hwndSysTabControl32 = IntPtr.Zero;
            IntPtr workCondition       = IntPtr.Zero;
            IntPtr preparedCheck       = IntPtr.Zero;
            IntPtr startButton         = IntPtr.Zero;

            do
            {
                if (!taskCore.NameCheck())
                {
                    return;
                }
                hwnd = HwndUtil.FindWindow("WTWindow", null);
                hwndSysTabControl32 = HwndUtil.FindWindowEx(hwnd, IntPtr.Zero, "SysTabControl32", "");
                workCondition       = HwndUtil.FindWindowEx(hwndSysTabControl32, IntPtr.Zero, "Button", "工作情况");
                jiutianCode         = "Afx:400000:b:10011:1900015:0";
                preparedCheck       = HwndUtil.FindWindowEx(workCondition, IntPtr.Zero, jiutianCode, "加载成功 可开始投票");
                if (preparedCheck == IntPtr.Zero)
                {
                    //不换
                    preparedCheck = HwndUtil.FindWindowEx(workCondition, IntPtr.Zero, "_EL_Label", "加载成功 可开始投票");
                    jiutianCode   = "_EL_Label";
                }
                if (preparedCheck == IntPtr.Zero)
                {
                    //WIN7
                    jiutianCode = "Afx:400000:b:10003:1900015:0";

                    preparedCheck = HwndUtil.FindWindowEx(workCondition, IntPtr.Zero, jiutianCode, "加载成功 可开始投票");
                }
                if (preparedCheck == IntPtr.Zero)
                {
                    //WIN10
                    jiutianCode   = "Afx:400000:b:10003:900015:0";
                    preparedCheck = HwndUtil.FindWindowEx(workCondition, IntPtr.Zero, jiutianCode, "加载成功 可开始投票");
                }
                startButton = HwndUtil.FindWindowEx(hwndSysTabControl32, IntPtr.Zero, "Button", "");
                startButton = HwndUtil.FindWindowEx(startButton, IntPtr.Zero, "Button", "开始投票");
                Thread.Sleep(500);
            } while (preparedCheck == IntPtr.Zero || startButton == IntPtr.Zero);
            //设置拨号延迟
            IntPtr hwndEx = HwndUtil.FindWindowEx(hwndSysTabControl32, IntPtr.Zero, "Button", "拨号设置");

            hwndEx = HwndUtil.FindWindowEx(hwndEx, IntPtr.Zero, "SysTabControl32", "");
            hwndEx = HwndUtil.FindWindowEx(hwndEx, IntPtr.Zero, "Edit", null);
            HwndUtil.setText(hwndEx, ConfigCore.Delay.ToString());
            //设置工号
            if (ConfigCore.InputId.Equals("1"))
            {
                hwndEx = HwndUtil.FindWindowEx(hwndSysTabControl32, IntPtr.Zero, "Button", "请输入工号");
                hwndEx = HwndUtil.FindWindowEx(hwndEx, IntPtr.Zero, "Edit", null);
                HwndUtil.setText(hwndEx, ConfigCore.Id);
            }
            HwndUtil.clickHwnd(startButton);
            Thread.Sleep(500);
            taskCore.FinishStart();
        }