private void ViewLoaded()
        {
            //MessageBox.Show("hi");
            //MessageBox.Show(CutBoardArgs.WzqGameProcess.MainWindowTitle);
            //游戏截图
            Bitmap bitmap = CaptureImage.Captuer(CutBoardArgs.WzqGameProcess);

            bitmap.Save("a.bmp");
            Process.Start("mspaint", "a.bmp");
        }
Beispiel #2
0
        private void ViewLoaded(RoutedEventArgs e)
        {
            Bitmap bitmap = CaptureImage.Captuer(CutBoardArgs.WzqGameProcess);

            GameBoardBitmap = bitmap;

            CutBoardWindow cutBoardWindow = e.Source as CutBoardWindow;
            StackPanel     stackPanel     = cutBoardWindow.Content as StackPanel;

            //寻找Canvas
            foreach (var item in stackPanel.Children)
            {
                if (item is Canvas)
                {
                    canvas = item as Canvas;
                    break;
                }
            }

            Configuration.Load();
            var config = Configuration as BaseConfiguration;

            MouseDownLocation = new System.Windows.Point(config.GameBoardPoint.X, config.GameBoardPoint.Y);
            MouseUpLocation   = new System.Windows.Point(
                MouseDownLocation.X + config.GameBoardInsideWidth,
                MouseDownLocation.Y + config.GameBoardInsideWidth);

            drawingRectangle = new System.Windows.Shapes.Rectangle()
            {
                Fill                = System.Windows.Media.Brushes.DarkGray,
                Opacity             = 0.8,
                HorizontalAlignment = HorizontalAlignment.Left,
                VerticalAlignment   = VerticalAlignment.Top
            };
            canvas.Children.Add(drawingRectangle);

            //重新移动矩形的位置
            DrawRectangle();
        }
Beispiel #3
0
        static void Main(string[] args)
        {
            List <WindowInfo> windowInfos = new List <WindowInfo>();

            EnumWindows((hWnd, lParam) => {
                StringBuilder sb = new StringBuilder(256);

                WindowInfo windowInfo = new WindowInfo();
                windowInfo.hWnd       = hWnd;

                GetWindowTextW(hWnd, sb, sb.Capacity);
                windowInfo.szWindowName = sb.ToString();

                GetClassNameW(hWnd, sb, sb.Capacity);
                windowInfo.szClassName = sb.ToString();

                windowInfos.Add(windowInfo);
                return(true);
            }, 0);

            foreach (var item in windowInfos)
            {
                if (item.szWindowName == "Default IME")
                {
                    continue;
                }
                if (item.szWindowName == "MSCTFIME UI")
                {
                    continue;
                }
                if (item.szClassName == "PalmInputUIStatus")
                {
                    continue;
                }
                if (item.szWindowName == "PalmInputUIStatus")
                {
                    continue;
                }
                if (item.szClassName == "tooltips_class32")
                {
                    continue;
                }
                if (item.szClassName == "WorkerW")
                {
                    continue;
                }
                if (item.szWindowName == "Default IME")
                {
                    continue;
                }


                Rectangle rectangle = new Rectangle();
                GetWindowRect(item.hWnd, ref rectangle);
                int width  = rectangle.Width - rectangle.X;
                int height = rectangle.Height - rectangle.Y;
                if (width < 20)
                {
                    continue;
                }
                if (height < 20)
                {
                    continue;
                }


                Console.WriteLine($"{item.hWnd}");
                Console.WriteLine($"{item.szWindowName}");
                Console.WriteLine($"{item.szClassName}");
                Console.WriteLine(rectangle.X);
                Console.WriteLine(rectangle.Y);
                Console.WriteLine(width);
                Console.WriteLine(height);
                Console.WriteLine();

                if (item.szClassName == "BS2CHINAUI" && item.szWindowName == "BlueStacks App Player")
                {
                    IntPtr windowHandle = item.hWnd;
                    Bitmap bitmap       = CaptureImage.Captuer(windowHandle);
                    bitmap.Save("a.bmp");
                    Process.Start("mspaint", "a.bmp");
                }
            }
        }