示例#1
0
 public static void CheckHeroFrame()
 {
     using (Graphics graphics = Graphics.FromHwnd(Win32Wrapper.GetDesktopWindow()))
     {
         graphics.DrawRectangle(new Pen(new SolidBrush(Color.Red), 3), GetHeroRectangle());
     }
 }
示例#2
0
文件: Utils.cs 项目: Antash/dia3bot
        public static Bitmap CaptureCursor(ref int x, ref int y)
        {
            Bitmap bmp;
            IntPtr hicon;

            Win32Wrapper.CURSORINFO ci = new Win32Wrapper.CURSORINFO();
            Win32Wrapper.ICONINFO   icInfo;
            ci.cbSize = Marshal.SizeOf(ci);
            if (Win32Wrapper.GetCursorInfo(out ci))
            {
                if (ci.flags == Win32Wrapper.CURSOR_SHOWING)
                {
                    hicon = Win32Wrapper.CopyIcon(ci.hCursor);
                    if (Win32Wrapper.GetIconInfo(hicon, out icInfo))
                    {
                        x = ci.ptScreenPos.x - ((int)icInfo.xHotspot);
                        y = ci.ptScreenPos.y - ((int)icInfo.yHotspot);

                        Icon ic = Icon.FromHandle(hicon);
                        bmp = ic.ToBitmap();
                        return(bmp);
                    }
                }
            }

            return(null);
        }
示例#3
0
文件: Utils.cs 项目: Antash/dia3bot
        public static bool IsDiabloWindowActive()
        {
            IntPtr        handle        = Win32Wrapper.GetForegroundWindow();
            StringBuilder stringBuilder = new StringBuilder(256);

            Win32Wrapper.GetWindowText(handle, stringBuilder, stringBuilder.Capacity);
            return(stringBuilder.ToString().Contains("Diablo") ? true : false);
        }
示例#4
0
文件: Utils.cs 项目: Antash/dia3bot
        static public System.Drawing.Color GetPixelColor(int x, int y)
        {
            IntPtr hdc   = Win32Wrapper.GetDC(IntPtr.Zero);
            uint   pixel = Win32Wrapper.GetPixel(hdc, x, y);

            Win32Wrapper.ReleaseDC(IntPtr.Zero, hdc);
            Color color = Color.FromArgb((int)(pixel & 0x000000FF),
                                         (int)(pixel & 0x0000FF00) >> 8,
                                         (int)(pixel & 0x00FF0000) >> 16);

            return(color);
        }
示例#5
0
        public static void CheckFullScreenFrame()
        {
            // Point cursorLocation;

            // Win32Wrapper.CURSORINFO cursorInfo;
            // Win32Wrapper.GetCursorInfo(out cursorInfo);



            // var p = new Point(cursorInfo.ptScreenPos.x, cursorInfo.ptScreenPos.y);
            // Screen screen = Screen.FromPoint(p);


            //Point upperLeftPoint = new Point(_screen.Bounds.Left, _screen.Bounds.Y);
            //Point upperRightPoint = new Point(_screen.Bounds.Right, _screen.Bounds.Y);
            //Point bottomLeftPoint = new Point(_screen.Bounds.X, _screen.Bounds.Top);
            //Point bottomRightPoint = new Point(_screen.Bounds.X, _screen.Bounds.Bottom);

            using (Graphics graphics = Graphics.FromHwnd(Win32Wrapper.GetDesktopWindow()))
            {
                graphics.DrawRectangle(new Pen(new SolidBrush(Color.Red), 5), Screen.Bounds);
            }
        }
示例#6
0
文件: Program.cs 项目: Antash/dia3bot
 public static void MouseLeftUp(Point p)
 {
     //| Win32Wrapper.MOUSEEVENTF_LEFTUP
     Win32Wrapper.mouse_event(Win32Wrapper.MOUSEEVENTF_LEFTUP, (uint)p.X, (uint)p.Y, 0, 0);
 }