title: winreg python know which webcam is being used
body: <p>I have a set of webcams and I need to know which one's are in use. I found this using winreg:</p>
  <pre><code>class WebcamDetect:
  REG_KEY = winreg.HKEY_CURRENT_USER
  WEBCAM_REG_SUBKEY = &quot;SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\CapabilityAccessManager\\ConsentStore\\webcam\\NonPackaged&quot;
  WEBCAM_TIMESTAMP_VALUE_NAME = &quot;LastUsedTimeStop&quot;
  
  def __init__(self):
      self._regKey = winreg.OpenKey( WebcamDetect.REG_KEY, WebcamDetect.WEBCAM_REG_SUBKEY )
  
  def getActiveApps(self):
      activeApps = []
      # Enumerate over the subkeys of the webcam key
      subkeyCnt, valueCnt, lastModified = winreg.QueryInfoKey( self._regKey )
      for idx in range(subkeyCnt):
          subkeyName = winreg.EnumKey( self._regKey, idx )
          subkeyFullName = f&quot;{WebcamDetect.WEBCAM_REG_SUBKEY}\\{subkeyName}&quot;
  
          # Open each subkey and check the 'stopped' timestamp value. A value of 0 implies the camera is in use.
          subkey = winreg.OpenKey( WebcamDetect.REG_KEY, subkeyFullName )
          stoppedTimestamp, _ = winreg.QueryValueEx( subkey, WebcamDetect.WEBCAM_TIMESTAMP_VALUE_NAME )
          if 0 == stoppedTimestamp:
              activeApps.append( subkeyName.replace(&quot;#&quot;, &quot;/&quot; ) )
              print(winreg.EnumValue(self._regKey, 0))
  
      return activeApps
  
  def isActive(self):
      return len(self.getActiveApps()) &gt; 0
  
  
  def webcam_detect():
  webcamDetect = WebcamDetect()
  while True:
      print(&quot;Applications using webcam:&quot;)
      for app in webcamDetect.getActiveApps():
          print(app)
      print(&quot;---&quot;)
      time.sleep(1)
  </code></pre>
  <p>Is there a way with this code to know which webcam is being used. Specifically I need the opencv index.</p>