Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Problem using QueryInterface with different IID

146 views
Skip to first unread message

charli...@my-dejanews.com

unread,
Jul 1, 1998, 3:00:00 AM7/1/98
to

Friends,

I am new to both Python and COM but I am jumping in with both feet. Here is
my problem:

I have a COM object that was written by others in my company. One of the
objects in the COM has two interfaces on it. I can access the default
interface with no problem but when I try to do a QueryInterface, I get the
error message:

TypeError: There is no interface object registered that supports this IID.

The document PythonCOM.html says that this is done using a "pyd" module that
is imported. Does this mean that for every interface that is accessed in
this manner a C or C++ module must be created specifically for that
interface? If this is needed, is there somewhere that I can see an example
of the code for that module? If not, how do I tell Python about the
interface object associated with the IID?


Thanks for the help

Charlie Davis
Truevision
charli...@truevision.com

-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/rg_mkgrp.xp Create Your Own Free Member Forum

Mark Hammond

unread,
Jul 2, 1998, 3:00:00 AM7/2/98
to

charli...@my-dejanews.com wrote in message
<6nd7k8$o2i$1...@nnrp1.dejanews.com>...


>Friends,
>
>I am new to both Python and COM but I am jumping in with both feet.
Here is
>my problem:
>
>I have a COM object that was written by others in my company. One
of the
>objects in the COM has two interfaces on it. I can access the
default
>interface with no problem but when I try to do a QueryInterface, I
get the
>error message:
>
> TypeError: There is no interface object registered that supports
this IID.

As you guessed, this error is telling you that the QI itself
succeeded, but Python did not have an object it could create that
supports this type.

>
>The document PythonCOM.html says that this is done using a "pyd"
module that
>is imported. Does this mean that for every interface that is
accessed in
>this manner a C or C++ module must be created specifically for that
>interface?

Exactly. Note however that many useful objects use the "IDispatch"
interface, but for custom objects that dont, this is true.

> If this is needed, is there somewhere that I can see an example
>of the code for that module? If not, how do I tell Python about
the
>interface object associated with the IID?

There are a number of examples in the win32com sources. The most
recent set are in the "internet" and "axcontrols" directory.

Also note that there are 2 options for generating the C code. One
is to use "makegw" that comes with win32com - it takes a .h file
that has geen itself generated from an IDL file, and create C source
code. But its not very flexible. There is also SWIG, which is far
more flexible, but probably a much higher learning curve to set up.
If the interfaces are small, and in a .H file generated from an IDL,
then check out "makegw" and the samples I mentioned (which
themselves where generated with makepy)

Mark.


0 new messages