Example #1
0
 private void tick(object sender, EventArgs e)
 {
     try
     {
         Win32Native.ClearMemory(base.Handle);
         IntPtr hWnd = Win32Native.FindWindow("地下城与勇士", "地下城与勇士");
         if (hWnd != IntPtr.Zero)
         {
             if (Win32Native.FindWindow("DNF_WND_CHAT", null) != IntPtr.Zero)
             {
                 Win32Native.RECT lpRect = new Win32Native.RECT();
                 Win32Native.GetWindowRect(hWnd, ref lpRect);
                 try
                 {
                     base.WindowState = FormWindowState.Maximized;
                     Win32Native.SetWindowPos(base.Handle, (int)hWnd, lpRect.Left + this.p.X, lpRect.Top + this.p.Y, this.s.Width, this.s.Height, 0x40);
                 }
                 catch
                 {
                 }
             }
         }
         else
         {
             this.timer.Stop();
             base.Close();
         }
     }
     catch
     {
     }
 }
        private static Rectangle?GetWindowRect(IntPtr hWnd)
        {
            var rect = new Win32Native.RECT();

            if (Win32Native.GetWindowRect(hWnd, ref rect))
            {
                return(new Rectangle(rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top));
            }
            return(null);
        }
Example #3
0
 private void SetWeGameForm(UserForm userForm, IntPtr HWND)
 {
     if (HWND == IntPtr.Zero)
     {
         userForm.isOpen = false;
         userForm.Hide();
     }
     else
     {
         Win32Native.RECT lpRect = new Win32Native.RECT();
         Win32Native.GetWindowRect(HWND, ref lpRect);
         int num  = lpRect.Right - lpRect.Left;
         int num2 = lpRect.Bottom - lpRect.Top;
         if ((num != 0x35e) && (num2 != 0x1e1))
         {
             try
             {
                 this.WeGameFourShow(HWND);
                 if (!UrlManage.weGameBlock)
                 {
                     if ((ComHelp.GetPixelColor(userForm.hideLocation1, HWND).ToString() == userForm.hideColor1) || (userForm.hideColor1 == "0"))
                     {
                         if (!userForm.isOpen)
                         {
                             if (!userForm.text.Contains("自适应"))
                             {
                                 Win32Native.SetWindowPos(userForm.Handle, 0, userForm.location1.X, userForm.location1.Y, userForm.size1.Width, userForm.size1.Height, 0);
                             }
                             Win32Native.SetParent(userForm.Handle, HWND);
                             userForm.isOpen = true;
                             userForm.Show();
                             //userForm.ShowDialog();
                         }
                         if (userForm.text.Contains("自适应X"))
                         {
                             Win32Native.SetWindowPos(userForm.Handle, 0, num + userForm.location1.X, userForm.location1.Y, userForm.size1.Width, userForm.size1.Height, 0);
                         }
                         if (userForm.text.Contains("自适应Y"))
                         {
                             Win32Native.SetWindowPos(userForm.Handle, 0, userForm.location1.X, num2 + userForm.location1.Y, userForm.size1.Width, userForm.size1.Height, 0);
                         }
                     }
                     else if (userForm.isOpen)
                     {
                         userForm.isOpen = false;
                         userForm.Hide();
                     }
                 }
             }
             catch
             {
             }
         }
     }
 }
Example #4
0
 private void CheckColor()
 {
     if (XmlHelper.GetPublicXmlValue("isCheck", true) == "0")
     {
         ParameterizedThreadStart para = delegate
         {
             string           s      = XmlHelper.GetPublicXmlAttributeValue("checkPoint", "x", true);
             string           str2   = XmlHelper.GetPublicXmlAttributeValue("checkPoint", "y", true);
             IntPtr           hWnd   = Win32Native.FindWindow("RCLIENT", "League of Legends");
             Win32Native.RECT lpRect = new Win32Native.RECT();
             Win32Native.GetWindowRect(hWnd, ref lpRect);
             Point  pt        = new Point(lpRect.Left + int.Parse(s), lpRect.Top + int.Parse(str2));
             string currColor = ComHelp.GetPixelColor(pt, hWnd).ToString();
             StatisticsHelp.ClolorStatistics(XmlHelper.GetPublicXmlAttributeValue("checkPoint", "okColor", true), currColor, pt);
         };
         this.Thread = new Thread(para);
         this.Thread.Start();
     }
 }
Example #5
0
 private void SetOtherParnetForm(UserForm userForm, IntPtr HWND)
 {
     if (HWND == IntPtr.Zero)
     {
         userForm.isOpen = false;
         userForm.Hide();
     }
     else
     {
         Win32Native.RECT lpRect = new Win32Native.RECT();
         Win32Native.GetWindowRect(HWND, ref lpRect);
         int num  = lpRect.Right - lpRect.Left;
         int num2 = lpRect.Bottom - lpRect.Top;
         if ((ComHelp.GetPixelColor(userForm.hideLocation1, HWND).ToString() == userForm.hideColor1) || (userForm.hideColor1 == "0"))
         {
             if (!userForm.isOpen)
             {
                 if (!userForm.text.Contains("自适应"))
                 {
                     Win32Native.SetWindowPos(userForm.Handle, 0, userForm.location1.X, userForm.location1.Y, userForm.size1.Width, userForm.size1.Height, 0);
                 }
                 Win32Native.SetParent(userForm.Handle, HWND);
                 userForm.isOpen = true;
                 userForm.Show();
             }
             if (userForm.text.Contains("自适应X"))
             {
                 Win32Native.SetWindowPos(userForm.Handle, 0, num + userForm.location1.X, userForm.location1.Y, userForm.size1.Width, userForm.size1.Height, 0);
             }
             if (userForm.text.Contains("自适应Y"))
             {
                 Win32Native.SetWindowPos(userForm.Handle, 0, userForm.location1.X, num2 + userForm.location1.Y, userForm.size1.Width, userForm.size1.Height, 0);
             }
         }
         else if (userForm.isOpen)
         {
             userForm.isOpen = false;
             userForm.Hide();
         }
     }
 }
Example #6
0
        private void SetLocation(object sender, EventArgs e)
        {
            IntPtr hWnd = Win32Native.FindWindow("TWINCONTROL", "WeGame");

            if (hWnd != IntPtr.Zero)
            {
                Win32Native.RECT lpRect = new Win32Native.RECT();
                Win32Native.GetWindowRect(hWnd, ref lpRect);
                int num = lpRect.Bottom - lpRect.Top;
                if (this.defHeight != num)
                {
                    this.defHeight = num;
                    int num2 = (num - base.Height) - 0x21;
                    base.Top  = num2;
                    base.Left = 500;
                    if (!this.isOpen)
                    {
                        this.isOpen = true;
                        try
                        {
                            base.WindowState = FormWindowState.Maximized;
                            Win32Native.SetParent(base.Handle, hWnd);
                        }
                        catch
                        {
                            this.isOpen = false;
                        }
                    }
                }
            }
            else
            {
                this.timer.Stop();
                this.isOpen = false;
                base.Close();
            }
        }
Example #7
0
        private void SetLoLForm(UserForm userForm, IntPtr HWND)
        {
            if (!UrlManage.lolBlock)
            {
                if (HWND == IntPtr.Zero)
                {
                    userForm.isOpen = false;
                    userForm.Hide();
                }
                else
                {
                    Win32Native.RECT lpRect = new Win32Native.RECT();
                    Win32Native.GetWindowRect(HWND, ref lpRect);
                    switch ((lpRect.Right - lpRect.Left))
                    {
                    case 0x400:
                        if ((ComHelp.GetPixelColor(userForm.hideLocation1, HWND).ToString() != userForm.hideColor1) && (userForm.hideColor1 != "0"))
                        {
                            if (!userForm.isOpen)
                            {
                                break;
                            }
                            userForm.isOpen = false;
                            userForm.Hide();
                            return;
                        }
                        Win32Native.SetWindowPos(userForm.Handle, 0, userForm.location1.X, userForm.location1.Y, userForm.size1.Width, userForm.size1.Height, 0);
                        Win32Native.SetParent(userForm.Handle, HWND);
                        userForm.isOpen = true;
                        userForm.Show();
                        return;

                    case 0x500:
                        ComHelp.GetPixelColor(userForm.hideLocation2, HWND).ToString();
                        if (ComHelp.GetPixelColor(userForm.hideLocation2, HWND).ToString() == userForm.hideColor2)
                        {
                            if (!userForm.isOpen)
                            {
                                Win32Native.SetWindowPos(userForm.Handle, 0, userForm.location2.X, userForm.location2.Y, userForm.size2.Width, userForm.size2.Height, 0);
                                Win32Native.SetParent(userForm.Handle, HWND);
                                userForm.isOpen = true;
                                userForm.Show();
                                return;
                            }
                            break;
                        }
                        if (!userForm.isOpen)
                        {
                            break;
                        }
                        userForm.isOpen = false;
                        userForm.Hide();
                        return;

                    case 0x640:
                        if (ComHelp.GetPixelColor(userForm.hideLocation3, HWND).ToString() == userForm.hideColor3)
                        {
                            Win32Native.SetWindowPos(userForm.Handle, 0, userForm.location3.X, userForm.location3.Y, userForm.size3.Width, userForm.size3.Height, 0);
                            Win32Native.SetParent(userForm.Handle, HWND);
                            userForm.isOpen = true;
                            userForm.Show();
                            return;
                        }
                        if (!userForm.isOpen)
                        {
                            break;
                        }
                        userForm.isOpen = false;
                        userForm.Hide();
                        return;

                    default:
                        userForm.isOpen = false;
                        userForm.Hide();
                        break;
                    }
                }
            }
        }