检查设备是否在使用中[UWP]

时间:2019-09-14 16:28:36

标签: c++ windows windows-runtime c++-winrt winrt-async

我正在通过WinRT使用C ++中的UWP API,并想检查相机是否在使用中(尝试访问或打开它之前):

using namespace winrt;
using namespace Windows::Devices::Enumeration;

auto cameras = DeviceInformation::FindAllAsync(DeviceClass::VideoCapture);
// choose camera...
for (const auto camera_info : camera_results)
{
    // camera_info.IsEnabled() returns 1, I guess it's not about in use or not
}

有没有一种方法可以获取设备(在这种情况下为相机)的状态(如果没有使用)?

即使使用WinAPI也不使用WinRT

0 个答案:

没有答案