[Python-au] IRtdServer with PythonCOM?

Mark Hammond mhammond@skippinet.com.au
Mon, 2 Dec 2002 22:32:54 +1100

Note that http://mail.python.org/mailman/listinfo/python-win32 is probably a
better forum (or comp.lang.python)

> This server needs to implement the IRtdServer interface
> (http://msdn.microsoft.com/library/default.asp?url=/library/en-us/

> 1. As I understand it, the pythoncom makes IDispatch objects, so
> as long as my object implements the necessary methods, it should
> work as an IRtdServer object. Am I correct on this?

Kind-of.  It depends on the caller.  If the interface is a real interface,
and also derives from IDispatch, then it is known as a "dual" interface.  By
default, Python can only implement IDispatch - not the interface itself.

If there is a type library describing IRtdServer (it may well simply be the
Office type library) - that is, if you can convince makepy to generate code
for this interface, then you will be able to do what you need using the new
"win32com.universal" module.

> 2. One of the IRtdServer methods has a parameter passed by reference
> (F$%* !!!).  This is the spec given by MS:

This is no problem - Python will return all byrefs from the function.  Eg,
it may look like:
  newNum = whatever.RefreshData(oldNum)

If there are multiple results, you get a tuple, so can be unpacked normally,
  rc, byref1, byref2 = obj.SomeFunc()