Skip to content

Instantly share code, notes, and snippets.

@joaompinto
Created March 16, 2023 21:14
Show Gist options
  • Save joaompinto/12d8cf53de5c99470d038243c39c29bc to your computer and use it in GitHub Desktop.
Save joaompinto/12d8cf53de5c99470d038243c39c29bc to your computer and use it in GitHub Desktop.
List ActiveX Class IDs and names
# Python re-implemention of the code found at:
#
# https://github.com/openwebos/qt/blob/master/src/activeqt/container/qaxselect.cpp
import winreg
clsid_keys = winreg.OpenKey(winreg.HKEY_CLASSES_ROOT, "CLSID")
i = 0
while True:
i = i + 1
try:
clsid = winreg.EnumKey(clsid_keys, i)
except OSError: # No more data is available
break
try:
subkey = winreg.OpenKey(clsid_keys, f"{clsid}\\Control")
except FileNotFoundError:
continue
ProgId_key = winreg.OpenKey(clsid_keys, f"{clsid}\\ProgId")
ControlName = winreg.EnumValue(ProgId_key, 0)[1]
print(clsid, ControlName)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment