johnny loops schrieb:
> I have been pining over implementing what seems to be a VB custom com
> interface for some time now, so I thought I would post to the list to see if
> anyone could help.
> 
> I have a com component on which I have run makepy.  The function generates a
> couple of classes with functions and callbacks that all work fine when I
> DispatchWithEvents.  However there is one interface that I cannot figure out
> how to use.  This interface is only referenced in the vtables section as
> 
> foo_vtables_dispatch_ = 0
> foo_vtables_ = [
>     (( 'OnFunc1' , 'variable1' , ), 1610678272, (1610678272, (), [ (36, 1,
> None, None) , ], 1 , 1 , 4 , 0 , 12 , (3, 0, None, None) , 0 , )),
>     (( 'OnFunc2' , 'variable2' , ), 1610678273, (1610678273, (), [ (36, 1,
> None, None) , ], 1 , 1 , 4 , 0 , 16 , (3, 0, None, None) , 0 , )),
> ]
> 
> foo is also listed in the VTablesToClassMap  and the NamesToIIDMap
> 
> Now, OnFunc1 and OnFunc2 are callback functions of an interface that I need
> to implement.  Once I implement the interface, I need to pass that object to
> another com object that will fire callbacks.  So reading some of these
> lists, I thought I should register the interface, create a server, wrap the
> server and pass it to the other com function.
> 
> For example:
> universal.RegisterInterfaces(CLSID,0,2,0,["foo"])
> class F:
>       _com_interfaces_=["foo"]
>      _typelib_guid_ = CLSID
>      _typelib_version_ = 2,0
>     _public_methods_ = [] or ['OnFunc1', 'OnFunc2'] -- i've tried both
>       def OnFunc1:
>             do some stuff
>       def OnFunc2
>             do some other stuff
> o=wrap(F)
> otherDispatchedComObject.FunctionThatNeedsInterface(o, otherInputs)
> 
> This does not produce any errors, but callbacks to OnFunc1 and OnFunc2 never
> fire-- and I know they are firing.  Also wrapping with a debugging
> dispatcher adds produces no information.  Callbacks to the regularly
> dispatched com objects do fire.
> 
> So my question is: Is what I am trying to do possible using win32com?  Does
> this seem like it should work?

I cannot comment on this question.

>  If not, does anyone have any suggestions
> using comtypes? I have read that vtable interfaces should be no problem for
> comtypes, but I can't find much in the way of documentation/examples.
> Basically, I'm lost here, to the point where I may have to switch to VB
> (eek)--so any help would be appreciated.


I have at least started writing some docs, and posted links to the ctypes users 
list:

  This describes how COM interfaces are defined, used, and implemented in 
comtypes:

  
http://svn.python.org/view/*checkout*/ctypes/trunk/comtypes/docs/com_interfaces.html

  and this describes the comtypes.client high-level module functionality:

  
http://svn.python.org/view/*checkout*/ctypes/trunk/comtypes/docs/comtypes.client.html

I hope these documents have some value.  Also I'm willing to help you
if you want to try out comtypes.

Thomas

_______________________________________________
Python-win32 mailing list
Python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32

Reply via email to