Menu

#129 Determine type of interface

closed-wont-fix
nobody
None
5
2013-05-06
2013-05-03
No

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.

Discussion

  • Stefan Schukat

    Stefan Schukat - 2013-05-03

    Patch for GetComIdentity

     
  • Mark Hammond

    Mark Hammond - 2013-05-06

    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.

     
  • Mark Hammond

    Mark Hammond - 2013-05-06
    • status: open --> closed-wont-fix
     

Log in to post a comment.