Hi,
It's fairly easy to capture screenshots using the gdi32 api.
Look at this article by James Crowley
http://www.developerfusion.com/code/4630/capture-a-screen-shot/[
^]
public Image CaptureWindow(IntPtr handle)
{
IntPtr hdcSrc = User32.GetWindowDC(handle);
User32.RECT windowRect = new User32.RECT();
User32.GetWindowRect(handle,ref windowRect);
int width = windowRect.right - windowRect.left;
int height = windowRect.bottom - windowRect.top;
IntPtr hdcDest = GDI32.CreateCompatibleDC(hdcSrc);
IntPtr hBitmap = GDI32.CreateCompatibleBitmap(hdcSrc,width,height);
IntPtr hOld = GDI32.SelectObject(hdcDest,hBitmap);
GDI32.BitBlt(hdcDest,0,0,width,height,hdcSrc,0,0,GDI32.SRCCOPY);
GDI32.SelectObject(hdcDest,hOld);
GDI32.DeleteDC(hdcDest);
User32.ReleaseDC(handle,hdcSrc);
Image img = Image.FromHbitmap(hBitmap);
GDI32.DeleteObject(hBitmap);
return img;
}
If you want to capture video then you could have a look Microsoft Expression encoder.
here is a code sample showing video capture:
_screenCaptureJob = new ScreenCaptureJob();
int width = Convert.ToInt32(area.Width / 4) * 4;
int height = Convert.ToInt32(area.Height / 4) * 4;
Rectangle rect = new Rectangle(area.Location, new Size(width, height));
_screenCaptureJob.CaptureRectangle = rect;
_screenCaptureJob.ShowFlashingBoundary = true;
_screenCaptureJob.ScreenCaptureVideoProfile.FrameRate = 8;
_screenCaptureJob.ScreenCaptureVideoProfile.Quality = 75;
_screenCaptureJob.CaptureMouseCursor = true;
_screenCaptureJob.OutputScreenCaptureFileName = Path.ChangeExtension(Path.Combine(this.textBox1.Text, Path.GetRandomFileName()), ".wmv");
_screenCaptureJob.Duration = new TimeSpan(0, 0, Convert.ToInt32(textBoxVideoLength.Text));
_screenCaptureJob.Start();
These two code sample are in c#.
Valery.