Click here to Skip to main content
15,885,032 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I've created a WinForms (C#) application and I have to add support for the built-in flash. The device is a Tablet PC running x64 architecture Windows 10 Professional (common Windows 10). Is there any way to do that? My application captures video from a built-in camera - I'm using OpenCV Sharp to do that, but I can't find any possibility to use a built-in flashlight. I need just manually turn on and off the light. I've found a lot of examples but it is possible only through UWP which I can't add to WinForms in any way. Does anyone know the way to use the built-in flashlight in WinForms Application?

What I have tried:

I've tried to use UWP Class Library in WinForms project but that's impossible and to find proper method in OpenCV Sharp which I'm using to capture video but I couldn't find proper one either.
Posted
Updated 10-Feb-20 4:29am

1 solution

Have you gone through this article from MS?
Use UWP APIs in desktop apps | Microsoft Docs[^]

Then you should be able to add in the namespaces needed, eg Windows.Devices.Lights
Windows.Devices.Lights Namespace - Windows UWP applications | Microsoft Docs[^]
 
Share this answer
 
Comments
petavius 11-Feb-20 7:06am    
Thanks a lot - I am able to add refrence to Windows.Devices.Lights now. My mistake was not to setup Default package management format to PackageReference in Default Package Management. Now it should work.
MadMyche 11-Feb-20 7:29am    
Glad it worked out for you!

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900