Screen capture functionality is required in most of the computer-based tasks. It is an inseparable part of eLearning; while developers need it while developing, testing or diagnosing certain piece of software. There are already several tools available for screen capturing; including PrntScrn (Print screen) functionality on Windows devices. However, developers will be happy to know a new way to do a screen capture and it is with WindowsGraphicsCapture API. The new UWP WindowsGraphicsCapture APIs offers a refined way to capture the screen in Win32 and UWP applications. Read further to know how to do a screen capture with WindowsGraphicsCapture.
What is WindowsGraphicsCapture API
WindowsGraphicsCapture APIs were first introduced in the Windows 10 April 2018 Update; also known as the 1803 update. WindowsGraphicsCapture APIs can capture application windows, displays, and environments. Screen capture with WindowsGraphicsCapture is secure and easy to use.
How to do a screen capture with WindowsGraphicsCapture
When you start the screen capture process with WindowsGraphicsCapture, the application gives options to choose the screen which you want to capture. As Windows team states, the operating system manages this experience and hence, UWP applications cannot spoof a request for access to windows outside of the capturing application’s process.
Once you select the required screen you wish to capture, the screen is highlighted with a yellow border. With this border, you know which screen is being captured by the application.
Other methods of screen capture on Windows
Windows team not only introduced WindowsGraphicsCapture, but also another method called the CreateFromVisual method. This screen capture method was introduced in the Windows 10 October Update; also known as 1809 update. This method enables applications to capture any child visual they “own”.
Developers can perform the following actions using CreateFromVisual:
- Save snapshots of visual trees (similar to RenderTargetBitmap)
- Save a stream of frames from their visual trees (can be hooked up to WinRT encoding APIs to save video)
- Apply expensive effects that are not supported by the compositor
- Because the application owns its content (by virtue of having access to the visuals), no dialog or consent is required. Instead, developers can construct a GraphicsCaptureItem that represents a visual by using a static method.
All in all, the Windows team offers a platter of screen capturing tools and methods that help the developers perform their tasks smoothly and effectively.
Read more about screen capture with WindowsGraphicsCapture and other screen capturing methods on the Windows Blog.
- Tags: Windows 10