Returning objects from PythonCOM servers
Jesper Eskilson
jojo at virtutech.se
Fri Apr 6 05:12:17 EDT 2001
Mark Hammond <MarkH at ActiveState.com> writes:
> I'm not exactly sure what you mean.
Sorry, but I don't really know much about COM, except what I've read in the
PythonCOM documentation. I was hoping to be able to fix this without
digging too deep into C++ and Visual Studio.
So bear with me if I ask any obvious or stupid questions.
> If you want to implement an interface described in a .tlb,
> servers\test_pycomtest is the only example (and only in the latest
> ActivePython, or win32all-138 and win32all-139)
>
> If you want to call an external object who's interface is described in a
> type library and the object does not support IDispatch, you can not.
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?
I got the impression that I could take a type-library, feed it to makepy
and from there get access to PGLOBAL_TARGET_INFO_STRUCT as some form of
Python object which could be passed back to the client. By studying the
tlbrowse.py application, I managed to extract some useful info from the
type library, but nothing that hinted how I could actually access the
objects themselves.
/Jesper
--
-------------------------------------------------------------------------
Jesper Eskilson jojo at virtutech.se
Virtutech http://www.virtutech.se
-------------------------------------------------------------------------
More information about the Python-list
mailing list