Uli Loose
Uli Loose

Reputation: 19

How do I take a screenshot from an UWP?

I want to read my bluetooth le heart rate sensor output programmatically.

How do I take a screenshot from an UWP?

Upvotes: 0

Views: 1230

Answers (1)

Adam Braden - MSFT
Adam Braden - MSFT

Reputation: 141

To your first point, most of the Bluetooth APIs are marked with the DualApiPartionAttribute - that means they can be called from UWP or a regular Win32/Winforms/WPF/.NET application. Visual Studio doesn't make this easy to reference for you yet. You need to first add the reference to the union Windows.WinMD for the version of windows you want to target, ie:

  • C:\Program Files (x86)\Windows Kits\10\UnionMetadata\10.0.16299.0\Windows.Winmd

and since many of apis are Async() you'll need to reference:

  • C:\Windows\Microsoft.NET\Framework\v4.0.30319\System.Runtime.WindowsRuntime.dll

Then the sample code looks essentially the same as UWP but called from your .NET app:

To your other questions about Screen capture, starting in Windows 1803, windows added a new Graphics Capture capability and apis. These classes are also marked DualApiPartitionAttribute so you can call them from either UWP or your Win32/.NET application. You can find more about them here:

Hope this helps,
-Adam

Upvotes: 2

Related Questions