470,647 Members | 1,268 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,647 developers. It's quick & easy.

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.

Mar 27 '06 #1
2 1305
On 27 Mar 2006 00:19:09 -0800, Axel Bock <ax************@googlemail.com> wrote:
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?


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

--
Cheers,
Simon B,
si***@brunningonline.net,
http://www.brunningonline.net/simon/blog/
Mar 27 '06 #2
late but still - thanks a lot :) . works like a charm.

cheers,
Axel.

Apr 20 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

12 posts views Thread by Ellarco | last post: by
31 posts views Thread by Jamie Burns | last post: by
3 posts views Thread by vijay.gandhi | last post: by
11 posts views Thread by Dinsdale | last post: by
13 posts views Thread by Rahul | last post: by
1 post views Thread by Korara | last post: by
reply views Thread by warner | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.