Knowing a COMObject by IID

Thomas Heller theller at python.net
Mon Aug 16 17:41:21 CEST 2004


Peter Hansen <peter at engcorp.com> writes:

> Mauro Baraldi wrote:
>
>> Someone can helpe-me how to get the name of a COMObject by it CLSID.
>> Example: A object got a number CLSID
>> ({CA8A9783-280D-11CF-A24D-444553540000}).
>> It name is Acrobat Control for ActiveX.
>> Or where can I found a good reference for this...
>
> The most direct method is to use "regedit" to search for it
> in your registry.  You can find it under HKEY_CLASSES_ROOT\CLSID
> and the name will be under the default key for the entry.
>
> But I suspect you wanted to do this programmatically...
> and I don't know the API you would use.

>>> import _winreg
>>> help(_winreg.QueryValue)
Help on built-in function QueryValue:

QueryValue(...)
    string = QueryValue(key, sub_key) - retrieves the unnamed value for a key.

    key is an already open key, or any one of the predefined HKEY_* constants.
    sub_key is a string that holds the name of the subkey with which the value
     is associated.  If this parameter is None or empty, the function retrieves
     the value set by the SetValue() method for the key identified by key.
    Values in the registry have name, type, and data components. This method
    retrieves the data for a key's first value that has a NULL name.
    But the underlying API call doesn't return the type, Lame Lame Lame, DONT USE THIS!!!

>>> _winreg.QueryValue(_winreg.HKEY_CLASSES_ROOT, "CLSID\\{CA8A9780-280D-11CF-A24D-444553540000}")
'Adobe Acrobat Control for ActiveX'
>>>

Thomas



More information about the Python-list mailing list