views:

4833

answers:

4

Is there a way to record the screen, either desktop or window, using .NET technologies.

My goal is something free. I like the idea of small, low cpu usage, and simple, but would consider other options if they created a better final product.

In a nutshell, I know how to take a screenshot in C#, but how would I record the screen, or area of the screen, as a video?

Thanks a lot for your ideas and time!

+1  A: 

There is a dll out there that can do it. Don't remember the name of it but it's used by Jing. A friend of mine implemented a screen recorder in just a few minutes by using that dll, just for testing. Check out Jing and you'll probably find the dll they use.

PEZ
I am trying to check out the jing project. I was given the impression that jing has a limit on the duration of recording that you can do. Maybe that limit is built right into the dll you are talking about. Also, it might not be under gpl/lgpl so it may not be "free" strictly speaking.
kinjal
In the jing license agreement: Separation of components - [...] Its component parts may not be separated for use [...].My advice: be safe.try searching google for: c# screen capture
kinjal
Just making sure everyone understands the goal is to record video of the screen, and not a simple bitmap screen capture.
CJCraft.com
I have no clue about the licensing deal for that dll. It's probably not open source or even free. But it does record video of the screen.
PEZ
+3  A: 

There is no need for a third party DLL. This simple method captures the current screen image into a .NET Bitmap object.

    private Image CaptureScreen()
    {
        Rectangle screenSize = Screen.PrimaryScreen.Bounds;
        Bitmap target = new Bitmap(screenSize.Width,screenSize.Height);
        using(Graphics g = Graphics.FromImage(target))
        {
            g.CopyFromScreen(0,0,0,0,new Size(screenSize.Width,screenSize.Height));
        }
        return target;
    }

I am sure you can figure out how to capture a smaller portion of the screen, if that is needed :-).

driis
Thanks, sorry I didn't make that clear enough, that I want to record video of the screen.
CJCraft.com
video is just many single frames pressed together, you could take these snapshots and create an AVI out of them pretty easily.
justin.m.chase
http://www.adp-gmbh.ch/csharp/avi/write_avi.html
justin.m.chase
I have considered this option, just threading the bitmaps together. I was just "assuming" there was something more "canned". Kind of like you shouldn't roll your own security API, there is already something better out there.
CJCraft.com
+1  A: 

Hi, You can use Windows media Encoder SDK to build a c# application to record the screen. There are i-built options to record the entire desktop or a particular screen in the desktop or a portion of desktop.

A: 

you can use media Encoder SDk but it is not support windows 7 so

chatura