Skip to main content

Screen source

Products: Video Capture SDK .Net

Engines: VideoCaptureCore, VideoCaptureCoreX

Screen capture is a process of copying what you see on your screen.

Video Capture SDK .Net allows you to capture the entire screen, a single window, or a selected area of the screen.

Windows

On Windows you can use DirectX 9 or DirectX 11/12 for screen capture. DirectX 11 and 12 are faster and more efficient than DirectX 9.

For window capture, you can use the DirectX 11.

To capture the mouse cursor, set the AllowCaptureMouseCursor property to true.

Use DisplayIndex to select the display to capture. The default value is 0.

Use ScreenPreview or ScreenCapture mode to preview or capture video from the device.

Capture full screen or screen area

To capture a screen specify the full screen mode or rectangle area.

// Set screen capture source settings
VideoCapture1.Screen_Capture_Source = new ScreenCaptureSourceSettings
{
// Set to true to capture the full screen
FullScreen = false,

// Set the left position of the screen area
Left = 0,

// Set the top position of the screen area
Top = 0,

// Set the width of the screen area
Width = 640,

// Set the height of the screen area
Height = 480,

// Set the display index
DisplayIndex = 0,

// Set the frame rate
FrameRate = new VideoFrameRate(25),

// Set to true to capture the mouse cursor
AllowCaptureMouseCursor = true
};

Capture window

To capture a window specify the window handle.

// Set screen capture source settings
VideoCapture1.Screen_Capture_Source = new ScreenCaptureSourceSettings
{
// Disable full screen capture
FullScreen = false,

// Set the window handle
WindowHandle = windowHandle,

// Set the frame rate
FrameRate = new VideoFrameRate(25),

// Set to true to capture the mouse cursor
AllowCaptureMouseCursor = true
};

Visit our GitHub page to get more code samples.