[python-win32] RTD Server problem with Excel 2007 / How to do vtable-call, without IDispatch?

Mark Hammond skippy.hammond at gmail.com
Thu May 26 00:50:24 CEST 2011


I'm afraid I can't really help, but:

On 25/05/2011 8:11 PM, Tobias Oberstein wrote:

> How can I call on the interface not via IDispatch, but using vtable-based direct call?

You can't I'm afraid.

However, your "casting" code might be suspect:

> # Need to "cast" the raw PyIDispatch object to the IRTDUpdateEvent interface
>     IRTDUpdateEventKlass = win32com.client.CLSIDToClass.GetClass('{A43788C1-D91B-11D3-8F39-00C04F3651B8}')
>     self.__callback = IRTDUpdateEventKlass(CallbackObject)

Look into using CastTo, or at least check that when the 
DispatchBaseClass is called that extra QueryInterface is done - it looks 
like it might not be.

> class IRTDUpdateEvent(DispatchBaseClass):
> 	CLSID = IID('{A43788C1-D91B-11D3-8F39-00C04F3651B8}')
> 	coclass_clsid = None
>
> 	def UpdateNotify(self):
> 		return self._oleobj_.InvokeTypes(10, LCID, 1, (24, 0), (),)
>
> and calls UpdateNotify via IDispatch.

Assuming the above is OK, the fact you got this far means that excel is 
exposing an IDispatch version of this interface - it is just rejecting 
it.  So maybe using IDispatch isn't the underlying problem...

HTH,

Mark


More information about the python-win32 mailing list