Screen recording and playback software written by myself

Source: Internet
Author: User

Recently, my work is idle, so I started to use code. I often need to record something when I use a computer, but it is a flash, so I want to have a screen recorder, if you want to register an image that is ready for use, you can simply write it by yourself. The idea is simple: capture a screen every second, save it, and then the player plays an image every second. I think that Niu X's function is to support global hotkeys. The main code is as follows:

Public bool copyscreen (string path) {// reference the namespace using system. drawing. imaging; rectangle rect = new rectangle (); rect = screen. getworkingarea (this); size mysize = new size (rect. width, rect. height); Bitmap bitmap = new Bitmap (rect. width, rect. height); graphics G = graphics. fromimage (Bitmap); G. copyfromscreen (0, 0, 0, 0, mysize); string imagename = path + @ "\" + datetime. now. tostring ("yyyymmddhhmmss") + ". Jpg"; try {// If the folder is deleted after the program is enabled, re-create if (! File. exists (PATH) {directory. createdirectory (PATH);} bitmap. save (imagename, imageformat. JPEG);} catch (exception ee) {MessageBox. show ("An error occurred while saving! Check whether space is insufficient! "); Return false;} bitmap. Dispose (); G. Dispose (); GC. Collect (); Return true ;}

Another major reason is that the program should be invisible. I did this:

 public CopyScreen()        {            InitializeComponent();            this.WindowState = FormWindowState.Minimized;            this.ShowInTaskbar = false;            SetVisibleCore(false);        }        protected override void SetVisibleCore(bool value)        {            base.SetVisibleCore(value);        }

This can still be seen in the task manager for debugging. Because I want to ensure the uniqueness of the program, this is what we will talk about next. The program can run only one instance.

     static void Main()        {            bool isAppRuning = false;            System.Threading.Mutex mutex=new System.Threading.Mutex(true,System.Diagnostics.Process.GetCurrentProcess().ProcessName, out isAppRuning);            if (isAppRuning) {            Application.EnableVisualStyles();            Application.SetCompatibleTextRenderingDefault(false);            Application.Run(new CopyScreen());            }            else            {                Environment.Exit(1);            }        }

There is also a global hot key. Let's do it by yourself.

How to use the program: after the program is started, there is no interface for the program. Press SHIFT + Z to start recording, press SHIFT + X to stop recording, and press Ctrl + Shift + A to take screenshots, shift + e exit. If no file program is generated, the created folder is automatically deleted. The generated folder is in the root directory of the program. It is recommended that you start the instance at startup, which is very convenient.

This is the player interface. Open the button to open the folder generated in the video, click Start to start playing, click play area to pause, and press start to continue.

This is basically the whole of the two small software, just enjoy the pleasure of making your own, hope you do not spray.

To get the compiled software and source code here: http://item.taobao.com/item.htm? SPM = 0.0.0.0.qths8l & id = 41209799164 ps. Accept the price negotiation.

It doesn't mean you have to collect money, but it is also the result of your own work, and the main code has been shared. I hope you don't miss me. Leave comments if you do not know. We also hope to provide more suggestions for optimization.

My shop has just opened: http://shop113034356.taobao.com /. It is not easy for programmers. I hope everyone can support it a lot. If you have the money, you can hold personal places. If you don't have the money, you can hold personal places.

 

Screen recording and playback software written by myself

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.