Пример #1
0
 /// <summary>
 /// 关闭数组中的title的窗口
 /// </summary>
 /// <param name="titleArr"></param>
 public static void CloseWindowByTitle(string[] titleArr)
 {
     foreach (var item in titleArr)
     {
         IntPtr tipsForm = WindowFormAPI.FindWindow(null, item);
         if (tipsForm.ToInt32() > 0)
         {
             IntPtr sureBtn = WindowFormAPI.GetDlgItem(tipsForm, 2);
             if (sureBtn.ToInt32() > 0)
             {
                 WindowFormAPI.ClickByIntPtr(sureBtn);
             }
         }
     }
 }
Пример #2
0
        private static void PinCheck()
        {
            IntPtr pinForm = WindowFormAPI.FindWindow(null, "用户 PIN 码验证");

            if (pinForm.ToInt32() > 0)
            {
                IntPtr pinText = WindowFormAPI.GetDlgItem(pinForm, 1000);
                IntPtr sureBtn = WindowFormAPI.GetDlgItem(pinForm, 1);
                if (pinText.ToInt32() > 0 && sureBtn.ToInt32() > 0)
                {
                    WindowFormAPI.SendMessage(pinText, WindowFormAPI.WM_SETTEXT, IntPtr.Zero, Config.PIN);
                    WindowFormAPI.ClickByIntPtr(sureBtn);
                }
            }
        }
Пример #3
0
        /// <summary>
        /// 弹窗提示,自动操作,如弹出硬件特征码校验,自动点击提交申请。
        /// </summary>
        private void TipsCheck()
        {
            IntPtr tipsForm = WindowFormAPI.FindWindow(null, "提示信息");

            if (tipsForm.ToInt32() > 0)
            {
                IntPtr sureBtn = WindowFormAPI.GetDlgItem(tipsForm, 2);
                IntPtr tipInfo = WindowFormAPI.GetDlgItem(tipsForm, 65535);
                if (tipInfo.ToInt32() > 0)
                {
                    StringBuilder s = new StringBuilder(512);
                    int           i = WindowFormAPI.GetWindowTextW(tipInfo, s, s.Capacity);
                    if (s.ToString().Contains("密码错误"))
                    {
                        passwordError = true;
                        SetText("用户名密码错误");
                    }
                }
                if (sureBtn.ToInt32() > 0)
                {
                    WindowFormAPI.ClickByIntPtr(sureBtn);
                }
            }

            IntPtr hardwareTipsForm = WindowFormAPI.FindWindow(null, "EasyConnect");

            if (hardwareTipsForm.ToInt32() > 0)
            {
                //硬件特征码校验
                IntPtr yingjianBtn = WindowFormAPI.GetDlgItem(hardwareTipsForm, 1201);
                //提交申请ID
                IntPtr submitBtn = WindowFormAPI.GetDlgItem(hardwareTipsForm, 1274);
                if (yingjianBtn.ToInt32() > 0 && submitBtn.ToInt32() > 0)
                {
                    WindowFormAPI.ClickByIntPtr(submitBtn);
                }
            }

            IntPtr jsTips = WindowFormAPI.FindWindow(null, "脚本错误");

            if (jsTips.ToInt32() > 0)
            {
                int tmp = 0;
                WindowFormAPI.SendMessage(jsTips.ToInt32(), WindowFormAPI.WM_CLOSE, 0, ref tmp);
            }
        }