Exemplo n.º 1
0
 public override void excute()
 {
     try
     {
         /*
          * 1.获取网盘窗口句柄
          * 2.前置,并最大化
          * 3.计算暂停位置,和开启位置
          * 4.先点击暂停,休眠5s,后点击启动
          *
          */
         IntPtr intPtr = WindowFormAPI.FindWindow(null, "PanDownload");
         WindowFormAPI.SetForegroundWindow(intPtr);
         WindowFormAPI.ShowWindow(intPtr, 1);
         Rect rect;
         WindowFormAPI.GetWindowRect(intPtr, out rect);
         int width  = rect.Right - rect.Left;
         int height = rect.Bottom - rect.Top;
         WindowFormAPI.MoveWindow(intPtr, 0, 0, width, height, false);
         int startX = 500, startY = 100;
         int stopX = 600, stopY = 100;
         WindowFormAPI.ClickByLocation(stopX, stopY);
         WindowFormAPI.ClickByLocation(stopX, stopY);
         Thread.Sleep(5000);
         WindowFormAPI.ClickByLocation(startX, startY);
         WindowFormAPI.ClickByLocation(startX, startY);
     }
     catch (Exception ex)
     {
     }
 }
Exemplo n.º 2
0
        static void Main(string[] args)
        {
            IntPtr tipsForm = WindowFormAPI.FindWindow(null, "提示信息");

            if (tipsForm.ToInt32() > 0)
            {
                IntPtr sureBtn = WindowFormAPI.GetDlgItem(tipsForm, 2);
                IntPtr tipInfo = WindowFormAPI.GetDlgItem(tipsForm, 65535);



                StringBuilder s = new StringBuilder(512);
                int           i = WindowFormAPI.GetWindowTextW(tipInfo, s, s.Capacity);


                if (sureBtn.ToInt32() > 0)
                {
                    WindowFormAPI.ClickByIntPtr(sureBtn);
                }
            }
        }
Exemplo n.º 3
0
        private void button1_Click(object sender, EventArgs e)
        {
            #region 1.获取到微信窗口,最大化,前置
            IntPtr weChatForm = WindowFormAPI.FindWindow("WeChatMainWndForPC", null);
            //注意,最大化,要在设置前置之前
            WindowFormAPI.ShowWindow(weChatForm, 3);
            WindowFormAPI.SetForegroundWindow(weChatForm);
            #endregion

            #region 2.点击搜索栏,粘贴搜索内容,点击最新的一条结果
            MouseFlag.MouseLefClickEvent(150, 35, 0);
            SetClipBordText(this.richTextBox1.Text);
            ControlKeyBoardClick(Keys.V);
            MouseFlag.MouseLefClickEvent(150, 100, 0);
            #endregion

            #region 3.点击内容框,ctrl+v,回车发送
            WindowFormAPI.ClickByLocation(700, 800);
            SetClipBordText("您的报价是,总计1000元!");
            ControlKeyBoardClick(Keys.V);
            WindowFormAPI.PostMessage(Keys.Enter, 0, 0, 0);
            WindowFormAPI.PostMessage(Keys.Enter, 0, WindowFormAPI.KEYEVENTF_KEYUP, 0);
            #endregion
        }