I uses pywin32
>>> import win32com.client
>>> fm = win32com.client.Dispatch("MCB.PCM")
>>> fm.ReadVariable('dwt')
(True, 0.02500000037252903, u'0.025', u'')
and I am getting it OK.
Now I am trying to add and register event handler and no luck yet :(
>>> ev = win32com.client.WithEvents(fm, evnt)
class evnt:
def OnEvent(self):
print "Hello..."
it does not work... I would like to know correct way to register event - any
idea?
Thank you very much.
On Saturday, June 21, 2014 8:17:23 PM UTC+2, Thomas Heller wrote:
> Am 21.06.2014 09:08, schrieb [email protected]:
>
> > Dears,
>
> >
>
> > I am not sure I am at right place here. Now I've started working with
> > comtypes 1.1.0 package within python 2.7.6.1. I have ActiveX COM object I
> > want access and work with it.
>
> >
>
> > I do following
>
> >>> from comtypes.client import CreateObject
>
> >>> fm = CreateObject("MCB.PCM")
>
> >>> dwt = fm.ReadVariable("dwt")
>
> >>> print dwt
>
> > (<comtypes.automation.LP_tagVARIANT object at 0x05A8E1C0>,
> > <comtypes.automation.LP_tagVARIANT object at 0x05A8E210>,
> > <comtypes.automation.LP_tagVARIANT object at 0x05A8E260>, True)
>
> >
>
> > by using print gives me return values. I want to access return data
> > (array)and variable. How can I correctly handle it?
>
>
>
> dwt apparently is an array containing pointers to VARIANTs. In
>
> comtypes (or ctypes) you dereference pointer by indexing them with zero.
>
> So something like this could work:
>
>
>
> for item in dwt:
>
> print item[0]
>
>
>
> Thomas
--
https://mail.python.org/mailman/listinfo/python-list