Beispiel #1
0
        private void MainForm_Load(object sender, EventArgs e)
        {
            var rawDeviceEnumerator = new RawInputDeviceEnumerator();

            foreach (var rawInputDevice in
                     rawDeviceEnumerator.Devices.Where(
                         d => d.DeviceType == Win32.RawInputDeviceType.Mouse))
            {
                Console.WriteLine(
                    "{0}:\n\tName = {1}\n\tHandle: = {2}\n",
                    rawInputDevice.DeviceType,
                    rawInputDevice.DeviceName,
                    rawInputDevice.DeviceHandle);
            }

            if (File.Exists("offsetX"))
            {
                offset.X = int.Parse(File.ReadAllText("offsetX"));
                offset.Y = int.Parse(File.ReadAllText("offsetY"));
            }
            fov = new Fov {
                Resolution = new Point(1280, 720), FieldOfView = new Rectangle((1280 / 2) - boxSize.X / 2, (720 / 2) - boxSize.Y / 2, boxSize.X, boxSize.Y)
            };
            bot     = new Aimbot(new Point(boxSize.X / 2, boxSize.Y / 2));
            scanner = new Scanner();
            Thread thread = new Thread(CaptureThread);

            thread.Start();
        }
Beispiel #2
0
        public static Bitmap CaptureFov(Fov fov)
        {
            var screenCopy = new Bitmap(fov.FieldOfView.Width, fov.FieldOfView.Height, PixelFormat.Format24bppRgb);

            using (var gdest = Graphics.FromImage(screenCopy))

                using (var gsrc = Graphics.FromHwnd(IntPtr.Zero))
                {
                    var hSrcDc = gsrc.GetHdc();
                    var hDc    = gdest.GetHdc();
                    var retval = BitBlt(hDc, 0, 0, fov.FieldOfView.Width, fov.FieldOfView.Height, hSrcDc, fov.FieldOfView.X, fov.FieldOfView.Y, (int)CopyPixelOperation.SourceCopy);

                    gdest.ReleaseHdc();
                    gsrc.ReleaseHdc();
                }

            return(screenCopy);
        }