If you are using dynamic dispatch you cannot determine the type of an interface in an easy way. This patch adds two methods which returns the name of the interface of an dynamic object. With this a basic type check could be done for an interface.
I'm not that keen on this. In general, I don't see there is demand for these functions (eg, I don't recall ever seeing a mailing-list question asking how this might be done, there seems nothing in pywin32 itself which would want to use it, and I've never personally come across the need for it). Regarding the code itself:
* New code should use pep8
* GetComIdentity() is a misleading name - the "identity" of a COM object is defined as the address of the pointer returned by a QI for IUnknown, so people familiar with COM will possibly be confused. GetDefaultInterfaceName would seem a better choice if this was to be implemented at all.
* IsTypeOf() seems misleading - if I already have an object which has been QI'd to the non-default interface, it seems the function will return False when passed that interface name.
If these make sense to your app/toolkit, they should probably be defined in your app/toolkit.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Patch for GetComIdentity
I'm not that keen on this. In general, I don't see there is demand for these functions (eg, I don't recall ever seeing a mailing-list question asking how this might be done, there seems nothing in pywin32 itself which would want to use it, and I've never personally come across the need for it). Regarding the code itself:
* New code should use pep8
* GetComIdentity() is a misleading name - the "identity" of a COM object is defined as the address of the pointer returned by a QI for IUnknown, so people familiar with COM will possibly be confused. GetDefaultInterfaceName would seem a better choice if this was to be implemented at all.
* IsTypeOf() seems misleading - if I already have an object which has been QI'd to the non-default interface, it seems the function will return False when passed that interface name.
If these make sense to your app/toolkit, they should probably be defined in your app/toolkit.