-->
Starting in Windows 10, version 1803, the Windows.Graphics.Capture namespace provides APIs to acquire frames from a display or application window, to create video streams or snapshots to build collaborative and interactive experiences.
Use Snipping Tool to Capture Screenshots. Sometimes the easiest way to make a copy of something is to take a snapshot of your screen. This is what Snipping Tool does. Capture all or part of your PC screen, add notes, save the snip, or email it from the Snipping Tool window. You can capture any of the following types of snips: Free-form snip. For your annotation convenience, this online screen capture application comes with a quick image editor for you to polish or annotate the screenshot upon its creation. You can add lines, arrows, texts and shapes to the image to highlight certain parts. There is also a blur tool for you to cover sensitive or private information.
With screen capture, developers invoke secure system UI for end users to pick the display or application window to be captured, and a yellow notification border is drawn by the system around the actively captured item. In the case of multiple simultaneous capture sessions, a yellow border is drawn around each item being captured.
Note
The screen capture APIs are only supported on desktop and Windows Mixed Reality immersive headsets.
This article describes capturing a single image of the display or application window. For information on encoding frames captured from the screen to a video file, see Screen capture to video
Add the screen capture capability
The APIs found in the Windows.Graphics.Capture namespace require a general capability to be declared in your application's manifest:
- Open Package.appxmanifest in the Solution Explorer.
- Select the Capabilities tab.
- Check Graphics Capture.
Launch the system UI to start screen capture
Before launching the system UI, you can check to see if your application is currently able to take screen captures. There are several reasons why your application might not be able to use screen capture, including if the device does not meet hardware requirements or if the application targeted for capture blocks screen capture. Use the IsSupported method in the GraphicsCaptureSession class to determine if UWP screen capture is supported:
Once you've verified that screen capture is supported, use the GraphicsCapturePicker class to invoke the system picker UI. The end user uses this UI to select the display or application window of which to take screen captures. The picker will return a GraphicsCaptureItem that will be used to create a GraphicsCaptureSession:
Because this is UI code, it needs to be called on the UI thread. If you're calling it from the code-behind for a page of your application (like MainPage.xaml.cs) this is done for you automatically, but if not, you can force it to run on the UI thread with the following code:
Create a capture frame pool and capture session
Using the GraphicsCaptureItem, you will create a Direct3D11CaptureFramePool with your D3D device, supported pixel format (DXGI_FORMAT_B8G8R8A8_UNORM), number of desired frames (which can be any integer), and frame size. The ContentSize property of the GraphicsCaptureItem class can be used as the size of your frame:
Next, get an instance of the GraphicsCaptureSession class for your Direct3D11CaptureFramePool by passing the GraphicsCaptureItem to the CreateCaptureSession method:
Once the user has explicitly given consent to capturing an application window or display in the system UI, the GraphicsCaptureItem can be associated to multiple CaptureSession objects. This way your application can choose to capture the same item for various experiences.
To capture multiple items at the same time, your application must create a capture session for each item to be captured, which requires invoking the picker UI for each item that is to be captured.
Acquire capture frames
With your frame pool and capture session created, call the StartCapture method on your GraphicsCaptureSession instance to notify the system to start sending capture frames to your app:
To acquire these capture frames, which are Direct3D11CaptureFrame objects, you can use the Direct3D11CaptureFramePool.FrameArrived event:
It is recommended to avoid using the UI thread if possible for FrameArrived, as this event will be raised every time a new frame is available, which will be frequent. If you do choose to listen to FrameArrived on the UI thread, be mindful of how much work you're doing every time the event fires.
Alternatively, you can manually pull frames with the Direct3D11CaptureFramePool.TryGetNextFrame method until you get all of the frames that you need.
The Direct3D11CaptureFrame object contains the properties ContentSize, Surface, and SystemRelativeTime. The SystemRelativeTime is QPC (QueryPerformanceCounter) time that can be used to synchronize other media elements.
Process capture frames
Each frame from the Direct3D11CaptureFramePool is checked out when calling TryGetNextFrame, and checked back in according to the lifetime of the Direct3D11CaptureFrame object. For native applications, releasing the Direct3D11CaptureFrame object is enough to check the frame back in to the frame pool. For managed applications, it is recommended to use the Direct3D11CaptureFrame.Dispose (Close in C++) method. Direct3D11CaptureFrame implements the IClosable interface, which is projected as IDisposable for C# callers.
Applications should not save references to Direct3D11CaptureFrame objects, nor should they save references to the underlying Direct3D surface after the frame has been checked back in.
While processing a frame, it is recommended that applications take the ID3D11Multithread lock on the same device that is associated with the Direct3D11CaptureFramePool object.
The underlying Direct3D surface will always be the size specified when creating (or recreating) the Direct3D11CaptureFramePool. If content is larger than the frame, the contents are clipped to the size of the frame. If the content is smaller than the frame, then the rest of the frame contains undefined data. It is recommended that applications copy out a sub-rect using the ContentSize property for that Direct3D11CaptureFrame to avoid showing undefined content.
Take a screenshot
In our example, we convert each Direct3D11CaptureFrame into a CanvasBitmap, which is part of the Win2D APIs.
Once we have the CanvasBitmap, we can save it as an image file. In the following example, we save it as a PNG file in the user's Saved Pictures folder.
React to capture item resizing or device lost
During the capture process, applications may wish to change aspects of their Direct3D11CaptureFramePool. This includes providing a new Direct3D device, changing the size of the frame buffers, or even changing the number of buffers within the pool. In each of these scenarios, the Recreate method on the Direct3D11CaptureFramePool object is the recommended tool.
When Recreate is called, all existing frames are discarded. This is to prevent handing out frames whose underlying Direct3D surfaces belong to a device that the application may no longer have access to. For this reason, it may be wise to process all pending frames before calling Recreate.
Putting it all together
The following code snippet is an end-to-end example of how to implement screen capture in a UWP application. In this sample, we have two buttons in the front-end: one calls Button_ClickAsync, and the other calls ScreenshotButton_ClickAsync.
Note
This snippet uses Win2D, a library for 2D graphics rendering. See their documentation for information about how to set it up for your project.
Record a video
If you want to record a video of your application, you can follow the walkthrough presented in the article Screen capture to video. Or, you can use Windows.Media.AppRecording namespace. This is part of the Desktop extension SDK, so it only works on desktop and requires that you add a reference to it from your project. See Programming with extension SDKs for more information.
See also
The interest in screenshots has increased steadily since 2009.
And it’s no secret that we’re big fans of screen capture and screenshots here at TechSmith.
Screenshots (also known as a screen grab or screen capture) are great to grab images from web pages, capture desktop applications, and create program how-tos.
And believe it or not, one of the biggest questions we get is: How do I capture a screenshot?
Well, there are a lot of built-in programs and free tools (Snipping Tool, Mac Grab, etc.) to capture your screen.
But, if you need to take a lot of screenshots and want more flexibility and robust tools, Snagit is a great option.
One of the best parts of capturing your screen with Snagit is that you can show people exactly what you see on your desktop.
Today, I’ll show you how to take a screenshot on Windows without the snipping tool and on Mac without the Grab tool.
The complete guide on how to capture screen images
Feel free to use the quick links to jump to the section that you are most interested in.
How to take a screenshot of your entire screen (Windows | Mac)
How to take a screenshot of a selected portion of your screen (Windows | Mac)
How to take a screenshot of a window (Windows | Mac)
How to take a screenshot of a menu (Windows | Mac)
The first thing you’ll want to do is download and install your screen capture software.
Capture your screen today!
Download a free trial of Snagit to quickly and easily take screenshots of your computer screen, mark them up, and share them.
If you don’t already have Snagit, you can download it for free and try the software for 15 days. Snagit works on both Windows and Mac. So no matter what platform you use it will work on your system.
You can capture your entire screen or only a selected portion of it. The screenshot automatically opens in the Snagit Editor where you can preview, edit, and share the capture.
How to take a screenshot on PC
Picture This Screen Capture Screen
These methods work with different versions of Microsoft Windows, including Windows 8 and Windows 10.
How to take a screenshot of your entire screen (on Windows 7, 8, and 10)
Step 1: Click the Capture button or Press PrtScn (Print Screen Button).
Step 2: Once the orange crosshairs appear, click the Fullscreen button to capture the full screen.
How to take a screenshot of a selected portion of your screen (on Windows 7, 8, and 10)
Step 1: Open the Capture window.
In the Notifications area, click the red TechSmith Snagit icon to open the Capture window on the screen. If you’re in the Snagit editor, click the Capture button in the toolbar to bring up the Capture window.
Step 2: Choose your screen capture settings.
The Capture window gives you a lot of flexibility depending on what type of screen capture you want to take. Grab your entire desktop, a region, or a window with Snagit’s All-in-One Capture®. Take a quick image screenshot, or even record a video.
Step 3: Click the Capture button.
Click the Capture button on any tab in the Capture window to start your screen capture. You can also start a capture with the current settings by pressing the PrtScn button (Print Screen), which is the default global capture hotkey. You can also customize and change the global capture hotkey.
Step 4: Click and drag the crosshairs to take a screenshot of the active window.
How to take a screenshot of a window (on Windows on Windows 7, 8, and 10)
Step 1: Click the Capture button or Press PrtScn (Print Screen).
Step 2: Move the cursor over the window to capture. When an orange dashed border appears around the window, click to select the highlighted area.
How to take a screenshot of a menu (on Windows on Windows 7, 8, and 10)
Step 1: First, select the Image tab in the Capture window.
Step 2: Next, select Menu in the Selection dropdown.
Step 3: Select the Delay option and set the number of seconds for the delay. (Optional)
Step 4: Click the Capture button or press PrtScn (Print Screen).
Step 5: Finally, your countdown will begin. Open the desired menu, and move your cursor over the menu to capture.
To save the capture settings for future use, select Add Preset dropdown > New preset from current settings.
How to take a screenshot on a Mac
These methods work with different versions of macOS–10.10 (Yosemite), or higher.
How to take a screenshot of your entire screen (on Mac)
Step 1: Click the Capture button or press Ctrl-Shift-C.
Step 2: Once the orange crosshairs appear, click the Fullscreen button to capture the entire screen.
How to take a screenshot of a selected portion of your screen (on Mac)
Step 1: Open the Capture window.
In the menu bar, click the TechSmith Snagit icon to open the Capture window on the screen. If you’re in the Snagit editor, click the Capture button in the toolbar to bring up the Capture window.
Step 2: Choose your screen capture settings.
The Capture window gives you a lot of flexibility depending on what type of screen capture you want to take. Grab your entire desktop, a region, or a window with Snagit’s All-in-One Capture®. Take quick image screenshots. Or even record videos.
Step 3: Click the capture button.
Click the Capture button on any tab in the Capture window to start your screen capture. You can also start a capture with the current settings by pressing using the keyboard shortcut Control-Shift-C, which is the default global capture hotkey. You can also customize and change the global capture hotkey.
Step 4: Click and drag the crosshairs to select part or all of your screen.
How to take a screenshot of a window (on Mac)
Step 1: Click the Capture button or press Control-Shift-C.
Step 2: Move the cursor over the window to capture. When an orange dashed border appears around the window, click to select the highlighted area.
How to take a screenshot of a menu (on Mac)
Step 1: First, select the Image tab in the Capture window.
Step 2: Next, select Menu in the Selection dropdown.
How Do I Capture A Screenshot
Step 3: Select the Delay option and set the number of seconds for the delay. (Optional)
Step 4: Click the Capture button or press Control-Shift-C.
Step 5: Finally, your countdown will begin. Open the desired menu, and move your cursor over the menu to capture.
After you’re done, you can save your screenshots or add polish with the image editing features in Snagit. This will you give you a faster and better workflow than just using the print screen key and Microsoft Paint.
Capture your screen today!
Download a free trial of Snagit to quickly and easily take screenshots of your computer screen, mark them up, and share them.
Screen Capture Picture From Computer
Frequently asked questions
How do I do a screen capture?Snagit is the best screen capture tool you can find. It’s perfect if you need to take a lot of screenshots and want more power and flexibility than built-in options.
How do you take a screenshot on Windows?Click the Capture button in Snagit or Press PrtScn (Print Screen). Then, click and drag the crosshairs to select part or all of your screen.
How do I do a screen capture on a Mac?Click the Capture button or press Ctrl-Shift-C. Then, click and drag the crosshairs to select part or all of your screen.
Can I turn screen captures into a video?Snagit now lets you turn screenshots into videos with narration and annotation. Learn how to Create Video from Images.
How do you take a scrolling screenshot?Free Screen Picture Capture
From Snagit’s All-in-one tab click the Capture button, move the crosshairs over the window to capture, and click one of the yellow arrows depending on the direction you want to scroll. Snagit captures everything visible in the window and creates a single image that you can edit.
How do I take a screenshot of a menu?First, select the Image tab in the Capture window. Next, select Menu in the Selection dropdown. Select the Delay option and set the number of seconds for the delay. Click the Capture button or press PrtScn (Print Screen). Finally, your countdown will begin. Open the desired menu, and move your cursor over the menu to capture.
Editor’s Note: This post was originally published in 2017 and has been updated for accuracy and comprehensiveness.