On 20:59, Thomas Heller wrote:
OLE Viewer finds a second interface IS7ProSimEvents that is 
made the default source makepy does not recognise 
IS7ProSimEvents as an interface at all.
      
It would appear that makepy is excluding non-dual interfaces, and that the
integration with the 'universal' support for vtable interfaces isn't
complete.
    

You could try comtypes: it should support custom interfaces and
custom event interfaces.

'easy_install comtypes==dev' to get the SVN version.

Thomas


  
Wow. The battle of the packages is afoot :-)
Thanks for the hint: I did not know about this package.
I have given it a try. There are a few things that appear strange to me.
At first I tried this:

import comtypes.client as cc
class testVehikel(cc.CreateObject(progid), eventsClass):

    def __init__(self):
    (...)  

This produced the following exception:
    class testVehikel(cc.CreateObject(progid), eventsClass):
TypeError: Error when calling the metaclass bases
    __init__ expected at most 1 arguments, got 3

I have no clue where this comes from, not even after trying to step towards the error. Does anyone?
So I did it slightly different:

import comtypes.client as cc
import comtypes.gen.S7PROSIMLib as S7PS
class testVehikel:
    def __init__(self, progid, eventsClass):
        self.intf = cc.CreateObject(progid)
        self.cb = eventsClass
        cc.GetEvents(self.intf, self.cb, S7PS.IS7ProSimEvents)

        (...)
    (.... other methods ....)
    def __del__(self):
        (.... some cleaning up ....)
      
This runs, except that the __del__ method gets called before I expect it, and after it is called the other testVehikel  methods still run fine.
How is this possible?

Is any of the above approaches to be preferred? Should I use yet another approach?

I final question:
What should the event routines look like? Currently they look like this:

class testCalls2:
    def ScanFinished(self, this, ScanInfo):
        print "Event: ScanFinished: ", ScanInfo
    (....)

on the basis of <clsid>.py, the result of GetMessage, saying this:

IS7ProSimEvents._methods_ = [
    COMMETHOD([helpstring(u'Fired when single scan is done.')], HRESULT, 'ScanFinished',
              ( [], VARIANT, 'ScanInfo' )),
    (....)

I thought to have read somewhere that I need a (not further needed) 'this' argument. Should I do it like this or should the 'this' argument go?
So far I have not been able to trigger any of these routines and make them do their printing.

Len.

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

Reply via email to