COM object pointer cast

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Axel Bock

    #1

    COM object pointer cast

    Hi,

    I am fooling around with the Python-COM bridge, and I have a little
    question with that.

    In the component I am using is a method which will return an "Entry"
    object - basically. In truth it returns some object which inherits from
    entry, and I know which one, but - as said - the method will only
    return the IEntry interface pointer. Now I would like to cast that one
    to the one I need :) . Is there an easy way to do it, or do I have to
    use the QueryInterface-method to get what I want?


    Greetings & thanks in advance,

    Axel.

  • Simon Brunning

    #2
    Re: COM object pointer cast

    On 27 Mar 2006 00:19:09 -0800, Axel Bock <axel.bock.news @googlemail.com > wrote:[color=blue]
    > I am fooling around with the Python-COM bridge, and I have a little
    > question with that.
    >
    > In the component I am using is a method which will return an "Entry"
    > object - basically. In truth it returns some object which inherits from
    > entry, and I know which one, but - as said - the method will only
    > return the IEntry interface pointer. Now I would like to cast that one
    > to the one I need :) . Is there an easy way to do it, or do I have to
    > use the QueryInterface-method to get what I want?[/color]

    There's an easy way - use win32com.client .CastTo(). See the
    convert_tracks. py script on this page -
    <http://www.brunningonl ine.net/simon/blog/archives/001742.html> for an
    example.

    --
    Cheers,
    Simon B,
    simon@brunningo nline.net,

    Comment

    • Axel Bock

      #3
      Re: COM object pointer cast

      late but still - thanks a lot :) . works like a charm.

      cheers,
      Axel.

      Comment

      Working...