示例#1
0
        private void StartRecord()
        {
            if (!Directory.Exists(tempFolderDir))
            {
                try
                {
                    Directory.CreateDirectory(this.tempFolderDir);
                    this.record = new Thread(() =>
                    {
                        int index = 0;
                        while (true)
                        {
                            string imageLocation = Path.Combine(this.tempFolderDir, "img-" + index + ".jpg");
                            Bitmap img           = ProcessContent.GetWindowContent(this.process);
                            img.Save(imageLocation, ImageFormat.Jpeg);

                            this.max_height = Math.Max(this.max_height, img.Height);
                            this.max_width  = Math.Max(this.max_width, img.Width);

                            Thread.Sleep(1000 / FPS);
                            index++;
                        }
                    });
                    this.record.Start();
                    this.isRecording = true;
                }
                catch { }
            }
        }
示例#2
0
        public MainWindow()
        {
            InitializeComponent();
            Process[] processlist = Process.GetProcesses();

            foreach (Process process in processlist)
            {
                if (!string.IsNullOrEmpty(process.MainWindowTitle))
                {
                    new Thread(() =>
                    {
                        RecordProcess rec = new RecordProcess(process.MainWindowHandle, Environment.GetFolderPath(Environment.SpecialFolder.MyPictures), process.Id.ToString());
                        rec.Start();
                        Thread.Sleep(5000);
                        rec.Stop();
                    }).Start();

                    Bitmap bmp = ProcessContent.GetWindowContent(process.MainWindowHandle);
                    bmp.Save(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyPictures), process.Id + ".bmp"));
                }
            }

            this.RenderImages("Pellicule");
        }