Returning objects from PythonCOM servers

Mark Hammond MarkH at ActiveState.com
Sat Apr 7 02:40:23 EDT 2001


Jesper Eskilson wrote:

> The problem is this: I'm writing a COM-server in Python which implements an
> interface. Some of the functions in the interface have, as parameters,
> datatypes defined in the type library. For example, from the IDL-file:
> 
> // HRESULT GetTargetInfo ([out] PGLOBAL_TARGET_INFO_STRUCT pgti);
>         
> PGLOBAL_TARGET_INFO_STRUCT is defined in the IDL-file as well. Now, how
> would I implement this function? Somehow I would need to fill in the
> structure PGLOBAL_TARGET_INFO_STRUCT and pass it back to the client, right?

Look for "record" in the win32com\test directory.  There are some 
examples.  However, it will depend on the type library if it works - the 
record must have a GUID.

If the makepy generated file has no reference to any "record"s, then I'm 
afraid you can't use these particular ones.  If "fixing" the TLB an option?

Mark.




More information about the Python-list mailing list