Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #73481
| X-Received | by 10.68.135.200 with SMTP id pu8mr4925273pbb.9.1403377737242; Sat, 21 Jun 2014 12:08:57 -0700 (PDT) |
|---|---|
| X-Received | by 10.140.50.239 with SMTP id s102mr57892qga.7.1403377737190; Sat, 21 Jun 2014 12:08:57 -0700 (PDT) |
| Path | csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!news.glorb.com!uq10no2535787igb.0!news-out.google.com!a8ni10889qaq.1!nntp.google.com!i13no8149457qae.1!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail |
| Newsgroups | comp.lang.python |
| Date | Sat, 21 Jun 2014 12:08:56 -0700 (PDT) |
| In-Reply-To | <c0m0cuFku88U1@mid.individual.net> |
| Complaints-To | groups-abuse@google.com |
| Injection-Info | glegroupsg2000goo.googlegroups.com; posting-host=79.127.213.14; posting-account=3-8a_goAAAB_5PU6hsuCwyp83CDnzdSO |
| NNTP-Posting-Host | 79.127.213.14 |
| References | <7b0712bf-68b0-4183-860d-2a39d22b62f4@googlegroups.com> <c0m0cuFku88U1@mid.individual.net> |
| User-Agent | G2/1.0 |
| MIME-Version | 1.0 |
| Message-ID | <b08e7948-57db-4f5d-ad76-49432c58fe8b@googlegroups.com> (permalink) |
| Subject | Re: comtypes |
| From | peter.balazovic@emspin.com |
| Injection-Date | Sat, 21 Jun 2014 19:08:57 +0000 |
| Content-Type | text/plain; charset=ISO-8859-1 |
| Xref | csiph.com comp.lang.python:73481 |
Show key headers only | View raw
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 peter.balazovic@emspin.com:
>
> > 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
Back to comp.lang.python | Previous | Next — Previous in thread | Find similar | Unroll thread
comtypes peter.balazovic@emspin.com - 2014-06-21 00:08 -0700
Re: comtypes John Gordon <gordon@panix.com> - 2014-06-21 16:34 +0000
Re: comtypes peter.balazovic@emspin.com - 2014-06-21 10:09 -0700
Re: comtypes Thomas Heller <theller@ctypes.org> - 2014-06-21 20:17 +0200
Re: comtypes peter.balazovic@emspin.com - 2014-06-21 12:08 -0700
csiph-web