1

I'm using Delphi 10.0 Seattle and trying to use the rear cameras's light on a Lenovo Thinkpad tablet running Windows 10 Pro. I am using TCameraComponent.

I tried using CameraComponent.TorchMode := TTorchMode.ModeOn from FMX.Media, but it raises an exception saying that the device has no torch.

Anyone know why this happens, and if there is some way to access this light/flash?

Remy Lebeau
  • 555,201
  • 31
  • 458
  • 770
Kiogara
  • 617
  • 1
  • 6
  • 15
  • Which version of Delphi are you using? – Remy Lebeau Aug 29 '16 at 23:51
  • 1
    Did you check `TCameraComponent.HasTorch` first? That will stop the exception. Are you sure your tablet has a torch and not just a flash? They're not the same thing. There's are separate properties for `HasFlash` and `FlashMode`. (I can see why a phone would have a torch (so you could use it like a flashlight), but I fail to see why a Thinkpad-sized tablet (laptop) would have one.) Does your tablet have a Lenovo utility to turn on the torch? – Ken White Aug 29 '16 at 23:51
  • I just checked the FMX source code in Delphi 10.0 Seattle and it does not implement **either** Flash or Torch functionality *at all* on Windows. It is only implemented on OSX, iOS, and Android. – Remy Lebeau Aug 30 '16 at 00:04
  • FlashMode didn't work as well and I didn't look for a flashlight like application in it. – Kiogara Aug 30 '16 at 00:10
  • 1
    Well, yeah. Like I said, FMX does not implement Flash or Torch on Windows. You will have to resort to using Windows-specific APIs instead to access any OS-level light/torch functionality. There are APIs in .NET for that, so hopefully there are corresponding Win32 APIs as well. – Remy Lebeau Aug 30 '16 at 00:10
  • Something like Windows Image Acquisition? I took a look at it, but haven't figured it ou how to use it – Kiogara Aug 30 '16 at 00:15
  • @Remy: It appears you have an answer to this question. You should post it. – Ken White Aug 30 '16 at 02:53

1 Answers1

2

FMX in Delphi 10.0 Seattle does not implement either Flash or Torch functionality at all on Windows. It is only implemented on OSX, iOS, and Android.

You will have to resort to using Windows-specific APIs, or even manufacturer-specific APIs, to access light/torch functionality. For example, there are FlashControl and TorchControl classes in the Windows UWP API.

Remy Lebeau
  • 555,201
  • 31
  • 458
  • 770